compile: version “go1.9” does not match go tool version “go1.9.1”
I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error mean and how can I fix this?
go
add a comment |
I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error mean and how can I fix this?
go
3
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wronggo
binary, or the source inGOROOT
doesn't match the tools and they need to be recompiled.
– JimB
Oct 11 '17 at 16:57
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
You should post the result ofgo env
.
– Lomanic
Oct 12 '17 at 12:23
2
In my case IntelliJ IDEA / Golang IDE setGOROOT
to a previous version of Go installed by homebrew.
– Brice
Feb 8 at 12:48
add a comment |
I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error mean and how can I fix this?
go
I am getting this error when I tried to run an example helloworld code I got onlie.
compile: version "go1.9" does not match go tool version "go1.9.1"
My computer has go1.9.1. What does the error mean and how can I fix this?
go
go
edited Oct 11 '17 at 19:27
ksrb
587317
587317
asked Oct 11 '17 at 16:50
sh0731
396620
396620
3
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wronggo
binary, or the source inGOROOT
doesn't match the tools and they need to be recompiled.
– JimB
Oct 11 '17 at 16:57
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
You should post the result ofgo env
.
– Lomanic
Oct 12 '17 at 12:23
2
In my case IntelliJ IDEA / Golang IDE setGOROOT
to a previous version of Go installed by homebrew.
– Brice
Feb 8 at 12:48
add a comment |
3
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wronggo
binary, or the source inGOROOT
doesn't match the tools and they need to be recompiled.
– JimB
Oct 11 '17 at 16:57
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
You should post the result ofgo env
.
– Lomanic
Oct 12 '17 at 12:23
2
In my case IntelliJ IDEA / Golang IDE setGOROOT
to a previous version of Go installed by homebrew.
– Brice
Feb 8 at 12:48
3
3
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wrong
go
binary, or the source in GOROOT
doesn't match the tools and they need to be recompiled.– JimB
Oct 11 '17 at 16:57
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wrong
go
binary, or the source in GOROOT
doesn't match the tools and they need to be recompiled.– JimB
Oct 11 '17 at 16:57
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
You should post the result of
go env
.– Lomanic
Oct 12 '17 at 12:23
You should post the result of
go env
.– Lomanic
Oct 12 '17 at 12:23
2
2
In my case IntelliJ IDEA / Golang IDE set
GOROOT
to a previous version of Go installed by homebrew.– Brice
Feb 8 at 12:48
In my case IntelliJ IDEA / Golang IDE set
GOROOT
to a previous version of Go installed by homebrew.– Brice
Feb 8 at 12:48
add a comment |
6 Answers
6
active
oldest
votes
If you are installing using OSX homebrew you may need to set the $GOROOT
in your .bashrc
, .zshrc
, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT
shouldn't have to be set and I had not set it until today. This may be a bug?
add a comment |
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
add a comment |
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install not just its binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
add a comment |
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
add a comment |
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
add a comment |
This is a mismatch between the GOROOT
environment variable and the default path to your go
command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go
(on Linux/macOS/BSD) or where go
(on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
- To change the
GOROOT
to match the default path of yourgo
command, runtype go
and strip off the/bin/go
part at the end to yield the directory path containing your Go installation. Then, add it to your.bashrc
or other appropriate init file like this:
export GOROOT=/path/to/go-installation
- To instead change the
go
command path to match yourGOROOT
, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the
GOROOT
to match the default path of yourgo
command, runwhere go
take the first line of output, and strip off thebingo.exe
part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.To instead change the
go
command path to match yourGOROOT
, first save the output ofecho %GOROOT%bin
. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46693653%2fcompile-version-go1-9-does-not-match-go-tool-version-go1-9-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you are installing using OSX homebrew you may need to set the $GOROOT
in your .bashrc
, .zshrc
, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT
shouldn't have to be set and I had not set it until today. This may be a bug?
add a comment |
If you are installing using OSX homebrew you may need to set the $GOROOT
in your .bashrc
, .zshrc
, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT
shouldn't have to be set and I had not set it until today. This may be a bug?
add a comment |
If you are installing using OSX homebrew you may need to set the $GOROOT
in your .bashrc
, .zshrc
, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT
shouldn't have to be set and I had not set it until today. This may be a bug?
If you are installing using OSX homebrew you may need to set the $GOROOT
in your .bashrc
, .zshrc
, etc:
export GOROOT=/usr/local/opt/go/libexec
I had the same error this morning when I updated from 1.9 -> 1.9.1 though according to several post the $GOROOT
shouldn't have to be set and I had not set it until today. This may be a bug?
edited Oct 11 '17 at 18:30
answered Oct 11 '17 at 18:25
ksrb
587317
587317
add a comment |
add a comment |
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
add a comment |
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
add a comment |
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
in case you are using mac with homebrew, just run:
brew cleanup
to clean all the legacy package, this fixed my problem.
answered May 5 at 3:31
hanleilei
9914
9914
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
add a comment |
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
This somehow worked for me. Thanks
– Huy
Sep 6 at 17:43
add a comment |
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install not just its binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
add a comment |
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install not just its binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
add a comment |
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install not just its binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
This error happens when you forgot to delete previous golang install ... just delete its directory ... so identify go install location ... on linux issue
type go
typical output is
go is hashed (/usr/local/go/bin/go)
so just remove its grandparent directory ( go install not just its binary )
sudo rm -rf /usr/local/go # NOTE this is not /usr/local/go/bin/go
now just install go and you'll be fine
answered Apr 5 at 17:35
Scott Stensland
15.6k75471
15.6k75471
add a comment |
add a comment |
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
add a comment |
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
add a comment |
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
In mac OS , if you downloaded and installed go package without brew, running brew update commands will cause this problem to occur
for fix this problem you can do :
brew uninstall --ignore-dependencies go
uninstalling go from brew will fix problem
answered Sep 24 at 12:30
Mohammad
319
319
add a comment |
add a comment |
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
add a comment |
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
add a comment |
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.
answered Nov 22 at 15:17
Yoruba
731510
731510
add a comment |
add a comment |
This is a mismatch between the GOROOT
environment variable and the default path to your go
command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go
(on Linux/macOS/BSD) or where go
(on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
- To change the
GOROOT
to match the default path of yourgo
command, runtype go
and strip off the/bin/go
part at the end to yield the directory path containing your Go installation. Then, add it to your.bashrc
or other appropriate init file like this:
export GOROOT=/path/to/go-installation
- To instead change the
go
command path to match yourGOROOT
, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the
GOROOT
to match the default path of yourgo
command, runwhere go
take the first line of output, and strip off thebingo.exe
part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.To instead change the
go
command path to match yourGOROOT
, first save the output ofecho %GOROOT%bin
. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
add a comment |
This is a mismatch between the GOROOT
environment variable and the default path to your go
command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go
(on Linux/macOS/BSD) or where go
(on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
- To change the
GOROOT
to match the default path of yourgo
command, runtype go
and strip off the/bin/go
part at the end to yield the directory path containing your Go installation. Then, add it to your.bashrc
or other appropriate init file like this:
export GOROOT=/path/to/go-installation
- To instead change the
go
command path to match yourGOROOT
, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the
GOROOT
to match the default path of yourgo
command, runwhere go
take the first line of output, and strip off thebingo.exe
part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.To instead change the
go
command path to match yourGOROOT
, first save the output ofecho %GOROOT%bin
. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
add a comment |
This is a mismatch between the GOROOT
environment variable and the default path to your go
command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go
(on Linux/macOS/BSD) or where go
(on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
- To change the
GOROOT
to match the default path of yourgo
command, runtype go
and strip off the/bin/go
part at the end to yield the directory path containing your Go installation. Then, add it to your.bashrc
or other appropriate init file like this:
export GOROOT=/path/to/go-installation
- To instead change the
go
command path to match yourGOROOT
, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the
GOROOT
to match the default path of yourgo
command, runwhere go
take the first line of output, and strip off thebingo.exe
part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.To instead change the
go
command path to match yourGOROOT
, first save the output ofecho %GOROOT%bin
. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
This is a mismatch between the GOROOT
environment variable and the default path to your go
command. One or the other needs to be changed; the one that needs to be changed depends on the specific setup on your computer. You could determine this by updating your Go to the latest version using your preferred method, running either which go
(on Linux/macOS/BSD) or where go
(on Windows), and then checking which of the files listed has the newer timestamp.
Linux/macOS/BSD
- To change the
GOROOT
to match the default path of yourgo
command, runtype go
and strip off the/bin/go
part at the end to yield the directory path containing your Go installation. Then, add it to your.bashrc
or other appropriate init file like this:
export GOROOT=/path/to/go-installation
- To instead change the
go
command path to match yourGOROOT
, add this to the bottom of your init file:
export PATH="${GOROOT}/bin:${PATH}"
Windows
To change the
GOROOT
to match the default path of yourgo
command, runwhere go
take the first line of output, and strip off thebingo.exe
part at the end. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", find the "GOROOT" variable and edit to read the path you created earlier.To instead change the
go
command path to match yourGOROOT
, first save the output ofecho %GOROOT%bin
. Then, go to "Edit the system environment variables" in Settings, click "Environment Variables...", and find the
find the "Path" row in the bottom pane, click New, put in the path you created earlier, and finally click Move Up until it's at the top.
All
You'll need to open up a new command prompt to see the effects.
answered Dec 6 at 23:48
Aaron Miller
644
644
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46693653%2fcompile-version-go1-9-does-not-match-go-tool-version-go1-9-1%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
You have something wrong with your Go installation. Either you have GOROOT set when it shouldn't be, you are invoking the wrong
go
binary, or the source inGOROOT
doesn't match the tools and they need to be recompiled.– JimB
Oct 11 '17 at 16:57
when you update Go remember delete /usr/local/go folder
– Yandry Pozo
Oct 11 '17 at 18:50
You should post the result of
go env
.– Lomanic
Oct 12 '17 at 12:23
2
In my case IntelliJ IDEA / Golang IDE set
GOROOT
to a previous version of Go installed by homebrew.– Brice
Feb 8 at 12:48