I\'m trying to set my $GOPATH variable to run some example code on my machine:
$GOPATH
$ smitego-example go run main.go main.go:5:2: cannot find packag
The accepted answer didn't work for me. I investigated and found the cause: I am using zsh, not bash.
I need to add the following two lines to ~/.zshrc:
~/.zshrc
export GOPATH=/Users/username/go export PATH=$GOPATH/bin:$PATH