You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving the check to an else after the path equality check should solve the issue, altough I'm not sure if this file verification has a concrete reason behind it:
// Guard against people setting GOPATH=$GOROOT.iffilepath.Clean(list[0]) ==filepath.Clean(cfg.GOROOT) {
returnfmt.Errorf("cannot download, $GOPATH must not be set to $GOROOT. For more details see: 'go help gopath'")
} else {
if_, err:=os.Stat(filepath.Join(list[0], "src/cmd/go/alldocs.go")); err==nil {
returnfmt.Errorf("cannot download, %s is a GOROOT, not a GOPATH. For more details see: 'go help gopath'", list[0])
}
}
What version of Go are you using (go version)?
go version go1.8 windows/amd64
What operating system and processor architecture are you using (go env)?
While I was configuring my workspaces I made the seemengly innocuous mistake of copying GOROOT files into my GOPATH folder. After that I couldn't download packages anymore
What did you expect to see?
I expected go get to install the desired package into my workspace
What did you see instead?
I get the following error: cannot download, C:\Users\user\go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'
The text was updated successfully, but these errors were encountered:
This is working as intended. The check exists to catch people who accidentally set their GOPATH to their GOROOT. But then you turned your GOPATH into a GOROOT by accident, and the check caught it.
Just delete those files and you're good. I don't think we need to modify cmd/go.
Seems good to me now that I know the rationale behind this, although I'd have preferred a distinctive error message for this case since the GOPATH and GOROOT env paths aren't equal, as the error message implies
go get GOROOT check is aggressive when GOPATH contains GOROOT files, specifically
src/cmd/go/alldocs.go
The offending check is here
Moving the check to an else after the path equality check should solve the issue, altough I'm not sure if this file verification has a concrete reason behind it:
What version of Go are you using (
go version
)?go version go1.8 windows/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH=amd64
GOBIN=
GOEXE=.exe
GOHOSTARCH=amd64
GOHOSTOS=windows
GOOS=windows
What did you do?
While I was configuring my workspaces I made the seemengly innocuous mistake of copying GOROOT files into my GOPATH folder. After that I couldn't download packages anymore
What did you expect to see?
I expected go get to install the desired package into my workspace
What did you see instead?
I get the following error:
cannot download, C:\Users\user\go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'
The text was updated successfully, but these errors were encountered: