When running the go get command :
sudo go get github.com/go-sql-driver/mysql
I get the following error
package github.com/go-sql-driver/mysql: cannot download, $GOPATH not set. For more details see: go help gopath
However $GOPATH is already set.
Running echo $GOPATH
gives /Users/userxyz/Desktop/Code
Running go env
gives
.....
GOPATH="/Users/userxyz/Desktop/Code"
...
GOROOT="/usr/local/go"
.....
I have already tried setting GOPATH as an environment variable by adding the following lines
export GOPATH="$HOME/Desktop/Code"
export PATH=$PATH:$GOPATH/bin
to the following files, alternatively
~/.profile (/etc/profile)
~/.bashrc
~/.bash_profile