GO:{GOOS}和{GOARCH}在环境中未被识别

I want to change my diretory to go/pkg/darwin_amd64 but $ cd $GOPATH/pkg/${GOOS}_${GOARCH} doesn't find the folder though directory exists.

$ echo $GOPATH/pkg/${GOOS}_${GOARCH} gives /go/pkg/_ instead of /go/pkg/darwin_amd64.

$ go env prints:

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/sahilkapoor/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"

We can see that GOOS and GOARCH are defined here. I am using terminal on Mac OSX 10.10.3. What am I missing?

$GOOS and $GOARCH will only be defined in your shell if you have exported them (which, unless you are doing cross compilation, is unlikely).

When you run go env, default values are shown when they have not been overwritten by your environment. You should change your command to the following to get the desired results:

cd $(go env GOPATH)/pkg/$(go env GOOS)_$(go env GOARCH)