Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: bad error when GOROOT not set correctly #34769

Open
rsc opened this issue Oct 8, 2019 · 0 comments

Comments

@rsc
Copy link
Contributor

commented Oct 8, 2019

Bad GOROOT is not diagnosed particularly well:

$ go build
$ GOROOT=/nonexist go build
go: cannot find GOROOT directory: /nonexist
$ GOROOT=/ go build
build rsc.io/kb/pw: cannot load bytes: malformed module path "bytes": missing dot in first path element
$

The first error is great. The second error is not. It should diagnose the bad GOROOT setting not complain about malformed module paths.

FWIW GOPATH mode is bad too but differently:

$ GOROOT=/ GO111MODULE=off go build
pw.go:16:2: cannot find package "bytes" in any of:
	/src/bytes (from $GOROOT)
	/Users/rsc/src/bytes (from $GOPATH)
../../../golang.org/x/crypto/blake2b/register.go:10:2: cannot find package "crypto" in any of:
	/src/crypto (from $GOROOT)
	/Users/rsc/src/crypto (from $GOPATH)
pw.go:17:2: cannot find package "crypto/rand" in any of:
	/src/crypto/rand (from $GOROOT)
	/Users/rsc/src/crypto/rand (from $GOPATH)
(many lines cut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.