Luis GG
Luis GG

Reputation: 81

Go get path is a GOROOT, not a GOPATH error, even with env set up in Windows

In Windows 8, whenever I try to download a package with go get and go install I get the following error:

cannot download, C:\Users\MYUSER\go is a GOROOT, not a GOPATH. For more details see: 'go help gopath'

I had manually set up the environment variables GOPATH, GOROOT and GOTOOLDIR for both the computer and the current user to no avail

User go env

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\MYUSER\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

Administrator prompt go env

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\MYUSER\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

Is this a known issue with go get or I'm still doing something wrong with my setup? Thanks in advance

Upvotes: 2

Views: 3296

Answers (1)

Luis GG
Luis GG

Reputation: 81

As it turns out, go get checks for the file "src/cmd/go/alldocs.go" to verify that the path is goroot. I opened an issue about the aggressive check but it was closed in a "won't fix" fashion. At least it could use a different error message, but that's how it works as of today

Upvotes: 6

Related Questions