Cannot Download, $GOPATH not set

Posted on

What is wrong here?

This error occurs when you have not set your go home location, because you are downloading an external package go will need to save the file somewhere and you need to tell it where you are working.

On the commandline;

echo $GOPATH

To confirm that that is in fact the problem. If it isn’t I can’t help you :(

Then on the command line type;

export GOPATH=/link/to/your/current/directory

Or if you want to be clever add it as an alias to your ~/.bashrc

alias gohome="export GOPATH=$(pwd)"

Now from the command line all you have to type is;

gohome

GOPATH will be get set to your current directory.