当我尝试运行时,go install我得到以下信息:
go install golang-book/chapter11/math: mkdir /Users/Swanros/Go/pkg/darwin_amd64: permission denied
然后我尝试sudo go install得到以下内容:
go install: no install location for directory /Users/Swanros/Go/src/golang-book/chapter11/math outside GOPATH
这是我的go env:
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Swanros/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"
echo $GOPATH 输出:
/Users/Swanros/Go
我错过了什么?我整个上午都在处理这个问题。
慕的地8271018
相关分类