Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go list on a package with an empty file doesn't return deps #35973

Closed
stamblerre opened this issue Dec 4, 2019 · 3 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@stamblerre
Copy link
Contributor

When a file in package is empty, go list fails with this error:

$ go list -e -json ~/mod1
{
	"Dir": "$HOME/rstambler/mod1",
	"ImportPath": "mod1",
	...
	"GoFiles": [
		"const.go",
		"mod1.go"
	],
	"Error": {
		"ImportStack": [
			"mod1"
		],
		"Pos": "",
		"Err": "\nmod2.go:1:1: expected 'package', found 'EOF'"
	}
}

Where mod1 contains files const.go, mod1.go, and mod2.go, the empty file. We had previously worked around this in go/packages (see CL 201220) by adding the file in the error message to the list of GoFiles. However, it has recently been noticed that this result is also missing the list of dependencies for the given package. Would it be possible for go list to return the correct list of deps for the other files in the package?

/cc @heschik @matloob

@jayconrod jayconrod added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 4, 2019
@jayconrod jayconrod added this to the Go1.14 milestone Dec 4, 2019
@jayconrod jayconrod self-assigned this Dec 4, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/209978 mentions this issue: go/packages: revert "handle invalid files in overlays"

gopherbot pushed a commit to golang/tools that referenced this issue Dec 5, 2019
This reverts commit 6f5e273, golang.org/cl/201220.

Reason for revert: Produces unusable Package results. See golang/go#35949 and golang/go#35973.

Fixes golang/go#35949.

Change-Id: Ic4632fe7f00366b1edf59840c83160d66499ba12
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209978
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/210097 mentions this issue: cmd/go: include imports in 'go list -e' output even after parse errors

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/210206 mentions this issue: go/packages: revert "handle invalid files in overlays"

gopherbot pushed a commit to golang/tools that referenced this issue Dec 6, 2019
This reverts commit 6f5e273, golang.org/cl/201220.

Reason for revert: Produces unusable Package results. See golang/go#35949 and golang/go#35973.

Fixes golang/go#35949.

Change-Id: Ic4632fe7f00366b1edf59840c83160d66499ba12
Reviewed-on: https://go-review.googlesource.com/c/tools/+/209978
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
(cherry picked from commit 427c522)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/210206
Reviewed-by: Heschi Kreinick <heschi@google.com>
@golang golang locked and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants