cmd/go: list prints leading underscore when given testdata directories #28155
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes - checked on 1.11.1.
What operating system and processor architecture are you using (
go env
)?What did you do?
Run
go list ./testdata
both in GOPATH and module mode.Copy and paste this into a shell:
What did you expect to see?
The same result in both cases.
What did you see instead?
Note that this only happens with testdata directories containing Go files. It doesn't happen with other directories that shouldn't be importable packages, like
_foo
.First, I'm confused by the weird
_/$GOPATH/src/$IMPORT_PATH
string, when I was expecting just the import path. I couldn't find any piece of documentation about this format.Second, I'm even more confused as to why this behaves differently depending on whether we're in GOPATH or module-aware mode.
This bug report is the result of digging a bit after the tests on a linter of mine were failing on 1.10. This was because
go/types.Type.String()
was returningmvdan.cc/unparam/check/testdata.FooType
on Go 1.11 withGO111MODULE=on
, but_/home/travis/gopath/src/mvdan.cc/unparam/check/testdata.FooType
on Go 1.10 withGO111MODULE=on
(since the env var is ignored there)./cc @bcmills (and thanks to @rogpeppe and @myitcv, who helped me investigate)
The text was updated successfully, but these errors were encountered: