I installed the Go, then added path requirements to my .bash_profile
:
export PATH=$PATH:/usr/local/go/bin
export GOPATH
I had the same problem in Windows 10,
So I set a system variable named GOBIN
with absolute value F:\go\bin
.
Then ran go install main.go
and everything worked perfectly fine!
The problem was as James Henstridge commented, for some reason there was an issue with my user directory name case. Even though the directory is lowercase, I had to make it capitalized.
This worked:
GOPATH=/Users/Daryl/go
This didn't:
GOPATH=$HOME/go
However, since moving to a rMBP from my iMac, I had no problems whatsoever setting up Go, so, to this day, I'm not sure what was going on, but in that instance the capitalization fixed it.
When you run go install
Go looks for $GOBIN
env variable path. Either you need to set your $GOBIN
to $GOPATH/bin
$ export GOBIN=$GOPATH/bin
and/or add $GOBIN
to your OS search path
$ export PATH=$PATH:$GOBIN
To use the command without getting the error.