As commented, your ~/.zshrc should set PATH to reference Go, as seen in the Go wiki:
Edit your
~/.zshrc
file to add the following line:
export GOPATH=$HOME/go
Save and exit your editor. Then, source your
~/.zshrc
.
source ~/.zshrc
As explained in the default GOPATH
and issue 17262, you don't need to set GOPATH.
But since Go 1.11 and its modules, you can now makes entire projects without ever using the default GOPATH
at all: everything would remain local to your project.
As of Go 1.11, the
go
command enables the use of modules when the current directory or any parent directory has ago.mod
, provided the directory is outside$GOPATH/src
.
(Inside$GOPATH/src
, for compatibility, thego
command still runs in the oldGOPATH
mode, even if ago.mod
is found)