Go comes with an installation package that makes it easy to build an environment without typing commands, but there are cases where it does not work when you try to run it. This is usually due to an incorrect path.
Set the path of Go
// for ZSH
$ vim ~/.zshrc
// for bash
$ vim ~/.bash_profile
Add /usr/local/bin/go
to the PATH
.
Set the path of go-bindata
I have received the following error when trying to make
a package for installation.
/bin/sh: go-bindata: command not found
The logs show that go-bindata was downloaded, but the command cannot be found. The directory ~/go/bin/go-bindata
exists, so the path does not work.
Since GOPATH
is often set directly under the home directory by convention, set GOPATH=$HOME/go
and add $GOPATH/bin
to the PATH
.
Configuration
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
If you can set it up as described above, it will work.
$ source ~/.zshrc
$ go version
go version go1.14.6 darwin/amd64