【问题】安装gocode命令:sudo go get github.com/nsf/gocode,出现错误提示:
package github.com/nsf/gocode: cannot download, $GOPATH not set. For more details see: go help gopath
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/kyle/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
【解决方案】
sudo env GOPATH=/Users/kyle/go go get github.com/nsf/gocode
【问题】
sudo go install github.com/nsf/gocode
can't load package: package github.com/nsf/gocode: cannot find package "github.com/nsf/gocode" in any of:
/usr/local/go/src/github.com/nsf/gocode (from $GOROOT)
($GOPATH not set)
【解决方案】
sudo env GOPATH=/Users/kyle/go go install github.com/nsf/gocode