Compilation: the version of "go1.9" does not match the version of go tool "go1.9.1"

I get this error when I try to run the helloworld sample code in which I got onlie.

compile: version "go1.9" does not match go tool version "go1.9.1"

My computer has go.1.9.1. What does the error mean and how can I fix it?

+12
source share
6 answers

If you are installing using homebrew OSX, you may need to install $GOROOTin .bashrc, .zshrcetc:

export GOROOT=/usr/local/opt/go/libexec

I had the same error this morning when I upgraded from 1.9 → 1.9.1, although, according to several reports, there is $GOROOTno need to install, and I have not installed it until today. Could this be a mistake?

+16
source

, mac homebrew, : brew cleanup

, .

+8

, golang... ... go install location... on linux issue

type go

go is hashed (/usr/local/go/bin/go)

( )

sudo rm -rf /usr/local/go   #  NOTE this is not /usr/local/go/bin/go

go

+3

Mac OS, go , , , : brew uninstall --ignore-dependations go uninstalling go from brew

0

Windows GOROOT Enviroment Variables .

enter image description here

0

GOROOT GOROOT go. ; , , . , , , which go ( Linux/MacOS/BSD) where go ( Windows), , .

Linux/MacOS/BSD

  • GOROOT go, type go GOROOT /bin/go , , Go. .bashrc :

export GOROOT=/path/to/go-installation

  • go go GOROOT, :

export PATH="${GOROOT}/bin:${PATH}"

Windows

  • GOROOT go, where go, where go , \bin\go.exe \bin\go.exe . " " "", " ...", "GOROOT" , , .

  • Instead, change the gocommands goaccording to yours GOROOT, first save the output echo %GOROOT%\bin. Then go to "Edit system environment variables" in "Settings", click "Environment variables ..." and find the line "Path" in the bottom panel, click "Create", enter the path that you created earlier, and finally click "Move up" until it returns above.

Everything

You will need to open a new command line to see the effects.

0
source

All Articles