Go: unknown subcommand "mod" darwin

Hello there ,
I have go 1.9.2 installed, setup GOPATH, GOBIN and GOROOT for my workspace folder. able to perform go run , go build go install .
while going through go modules , I am not able to perform go mod
it gives me the following error
➜ happydog go mod
go: unknown subcommand “mod”
Run ‘go help’ for usage.

I came across another similar post question for linux platform , but It didn’t seem to solve my problem.
I am using go 1.9.2 darwin/amd64.
Just wanted to check if If I am missing something here like setting up the environments properly.
Thanks in Advance.

following is the output for go env
➜ happydog go env
GOARCH=“amd64”
GOBIN="/Users/anupam/goworkspace/bin"
GOEXE=""
GOHOSTARCH=“amd64”
GOHOSTOS=“darwin”
GOOS=“darwin”
GOPATH="/Users/anupam/goworkspace"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/pkg/tool/darwin_amd64"
GCCGO=“gccgo”
CC=“clang”
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vq/k7brm36d3fldd8m0p_9bbspw0000gp/T/go-build375648247=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX=“clang++”
CGO_ENABLED=“1”
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG=“pkg-config”

Go modules are only available since 1.11 (behind feature gate) and 1.12 (enabled by default).

You need to update your version of go.

3 Likes

Thanks a lot @NobbZ , my bad it was bit confusing for me … the whole time I was thinking version 1.9.2 is greater than 1.11 or 1.12 :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.