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