cd $(mktemp -d)
mkdir -p src/example.com/p
echo 'package p' >src/example.com/p/p.go
go doc example.com/p
What did you expect to see?
go doc example.com/p should fail. Module mode is turned on explicitly with GO111MODULE=on, and that package only exists in this fake GOPATH.
What did you see instead?
go doc example.com/p succeeds with the output below:
warning: pattern "all" matched no module dependencies
go doc executes cmd/doc, which loads a package with go/build.Import. There is a heuristic which guesses whether module mode is enabled by looking for a go.mod file. If one is found, it loads the package by executing go list.
The heuristic should assume modules are enabled when GO111MODULE is explicitly on.
The text was updated successfully, but these errors were encountered: