Compile: version "go1.13" does not match go tool version "go1.13.8"

I am a go novice
trying to build on my Mac
get this error I have uninstalled go and reinstalled go via brew

prometheus-exporter-netapp (master) $ make
/Library/Developer/CommandLineTools/usr/bin/make clean
rm -rf target
/Library/Developer/CommandLineTools/usr/bin/make build-all
/Library/Developer/CommandLineTools/usr/bin/make build-darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -tags netgo -ldflags ‘-w’ -o target/darwin/prometheus-exporter-netapp

unicode/utf8

compile: version “go1.13” does not match go tool version “go1.13.8”

encoding

compile: version “go1.13” does not match go tool version “go1.13.8”

gitlab $ echo $PATH
/Users/mark.pendrick/gocode/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
gitlab $ echo $GOPATH
/Users/mark.pendrick/gocode
gitlab $

Why don’t you install Go from https://golang.org/dl/?

@Mark_Pendrick

Most probably you have two standard lib installations on your system, one from the original Go installation, and the other one from the brew installation. The Go tools use $GOROOT to find the standard library, and apparently $GOROOT points to the wrong one.

  • Call go env GOROOT. With a Homebrew installation of go, it should point to /usr/local/Cellar/go/1.13.8/libexec. If it doesn’t, change the GOROOT env var in your shell accordingly and look if the error is gone.
  • In general, you will want to remove all artifacts of the old Go installation. brew install go does not automatically uninstall other (read: non-brew) Go installations.

See also:

(found via Web search: "compile: version" "does not match go tool version")

@lutzhorn there is nothing wrong per se about installing Go via brew. I use brew for Go since years and am living happily with it :slight_smile:

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