cmd/go: poor error message with '-mod=vendor' when loading a package that is not vendored
bcmills opened this issue · 0 comments
bcmills commented
(This issue is split out from #41916. #38748 is closely related.)
What version of Go are you using (go version)?
example.com$ go version
go version devel +9449a125e Sun Oct 11 17:54:59 2020 +0000 linux/amd64
What did you do?
go mod vendor
go list golang.org/x/tools/cmd/goimports
-- go.mod --
module example.com
go 1.16
require golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
-- main.go --
package main
import _ "golang.org/x/tools/imports"
func main() {}
What did you expect to see?
An error message that explicitly mentions the user-provided path (golang.org/x/tools/cmd/goimports) the fact that that path is not vendored, and (perhaps) the fact that -mod=vendor is set by default because the vendor directory exists.
What did you see instead?
cannot find package "." in:
/tmp/tmp.xYGlB041oB/example.com/vendor/golang.org/x/tools/cmd/goimports