0

I'm trying to install a Go package (https://github.com/jteeuwen/go-bindata#installation) by running this command

go get -u github.com/jteeuwen/go-bindata/...

I get this error:

package github.com/jteeuwen/go-bindata/...: cannot download, $GOPATH not set. For more details see: go help gopath

My GOPATH is set in the ordinary way. I understand this is caused by the -u command... how do I resolve this?

user3918985
  • 4,278
  • 9
  • 42
  • 63

1 Answers1

0

It depends on your OS, but make sure your GOPATH is set in your .bashrc (as in this question) or least set with

export GOPATH=/home/<username>/go

That way, other processes (like go get) will inherit that variable.

On Windows, you would declare that variable in your user environment variables.

To check what is already set ("Print Go environment information"):

go env

If the variable is already set, but a go get -u still fails, then this could be similar to issue 42:

Your issue is that you have installed go to a location that requires privilege escalation to install to.

Check also your GOROOT and where go is installed.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250