go version go1.12.9 darwin/amd64
When I installed the golang.org/x/tour project, I ran the comman tour
and got an error:
Couldn't find tour files: could not find go-tour content; check $GOROOT and $GOPATH
Here is my 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"
I add two lines in .zshrc
:
export GOPATH="$HOME/ccode/go"
export PATH="$PATH:$GOPATH/bin"
The command go get golang.org/x/tour
was running with no error.
The strange thing is:
echo $GOROOT
will display a blank line
And echo $GOPATH
is consistent with go env.