I'm trying to install the Oracle Driver for Go (go-oci8) following these instructions
The problem I'm facing is with the $GOPATH environment variable. When I execute the command:
sudo go get github.com/mattn/go-oci8
I get the error :
cannot download, $GOPATH not set. For more details see: go help gopath
However, I have the GOPATH properly set. My environment looks like this:
env | grep GO
GOARCH=amd64
GOROOT=/usr/local/go
GOOS=linux
GOPATH=/home/myuser/go/
ls $GOPATH
bin pkg src
I've found a similar post but the solution does not apply to my case.
Sudo won't honor all your ENV variables for some very good security reasons.
The simplest way to fix this is /bin/env
sudo /bin/env GOPATH=/home/myuser/go go get <stuff>
But you don't need to do that, you really shouldn't need root to write to GOPATH, only GOROOT.