go version go1.12.9 darwin/amd64
安装该golang.org/x/tour软件包后,我运行命令tour并收到错误:
Couldn't find tour files: could not find go-tour content; check $GOROOT and $GOPATH
这是输出go env:
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/elk/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/elk/ccode/go"
GOPROXY="https://goproxy.io"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5d/q9dj2fxx4t71w0g5g00cvlkh0000gn/T/go-build144784202=/tmp/go-build -gno-record-gcc-switches -fno-common"
我在里面添加两行.zshrc:
export GOPATH="$HOME/ccode/go"
export PATH="$PATH:$GOPATH/bin"
该命令go get golang.org/x/tour运行时没有错误。
奇怪的是: echo $GOROOT会显示一个空行并且echo $GOPATH与 一致go env。
繁华开满天机
森林海
缥缈止盈
明月笑刀无情
相关分类