Skip to content

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

Closed
@stamblerre

Description

@stamblerre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions