cmd/go: go list -json -e
does not store location for invalid import path
#69334
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go version go1.23.1 linux/arm64
Output of
go env
in your module/workspace:What did you do?
I have the following invalid Go file
I ran
go list -json -e importpath.go
on it, to see the loader error.What did you see happen?
The JSON contains this part:
That's an error, of course, but the
Pos
field is not set even thoughgo list
clearly knows the source location (it's stored in the error message itself).What did you expect to see?
I expected an output like this:
That is, the position information should be in
Pos
and the path should be relative and not absolute. For example, when setting the import path to one that doesn't exist, the error looks like this:The text was updated successfully, but these errors were encountered: