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












12














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?










share|improve this question




















  • 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












  • 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
















12














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?










share|improve this question




















  • 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












  • 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














12












12








12


2





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?










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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










  • 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














  • 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












  • 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








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












6 Answers
6






active

oldest

votes


















16














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?






share|improve this answer































    8














    in case you are using mac with homebrew, just run:

    brew cleanup



    to clean all the legacy package, this fixed my problem.






    share|improve this answer





















    • This somehow worked for me. Thanks
      – Huy
      Sep 6 at 17:43



















    3














    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






    share|improve this answer





























      0














      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






      share|improve this answer





























        0














        For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.



        enter image description here






        share|improve this answer





























          0














          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 your go command, run type 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 your GOROOT, 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 your go command, run where go take the first line of output, and strip off the bingo.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 your GOROOT, first save the output of echo %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.






          share|improve this answer





















            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            16














            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?






            share|improve this answer




























              16














              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?






              share|improve this answer


























                16












                16








                16






                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?






                share|improve this answer














                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?







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Oct 11 '17 at 18:30

























                answered Oct 11 '17 at 18:25









                ksrb

                587317




                587317

























                    8














                    in case you are using mac with homebrew, just run:

                    brew cleanup



                    to clean all the legacy package, this fixed my problem.






                    share|improve this answer





















                    • This somehow worked for me. Thanks
                      – Huy
                      Sep 6 at 17:43
















                    8














                    in case you are using mac with homebrew, just run:

                    brew cleanup



                    to clean all the legacy package, this fixed my problem.






                    share|improve this answer





















                    • This somehow worked for me. Thanks
                      – Huy
                      Sep 6 at 17:43














                    8












                    8








                    8






                    in case you are using mac with homebrew, just run:

                    brew cleanup



                    to clean all the legacy package, this fixed my problem.






                    share|improve this answer












                    in case you are using mac with homebrew, just run:

                    brew cleanup



                    to clean all the legacy package, this fixed my problem.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 5 at 3:31









                    hanleilei

                    9914




                    9914












                    • 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




                    This somehow worked for me. Thanks
                    – Huy
                    Sep 6 at 17:43











                    3














                    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






                    share|improve this answer


























                      3














                      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






                      share|improve this answer
























                        3












                        3








                        3






                        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






                        share|improve this answer












                        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







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Apr 5 at 17:35









                        Scott Stensland

                        15.6k75471




                        15.6k75471























                            0














                            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






                            share|improve this answer


























                              0














                              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






                              share|improve this answer
























                                0












                                0








                                0






                                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






                                share|improve this answer












                                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







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Sep 24 at 12:30









                                Mohammad

                                319




                                319























                                    0














                                    For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.



                                    enter image description here






                                    share|improve this answer


























                                      0














                                      For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.



                                      enter image description here






                                      share|improve this answer
























                                        0












                                        0








                                        0






                                        For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.



                                        enter image description here






                                        share|improve this answer












                                        For Windows delete the GOROOT System variables in the Enviroment Variables and restart the PC.



                                        enter image description here







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Nov 22 at 15:17









                                        Yoruba

                                        731510




                                        731510























                                            0














                                            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 your go command, run type 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 your GOROOT, 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 your go command, run where go take the first line of output, and strip off the bingo.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 your GOROOT, first save the output of echo %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.






                                            share|improve this answer


























                                              0














                                              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 your go command, run type 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 your GOROOT, 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 your go command, run where go take the first line of output, and strip off the bingo.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 your GOROOT, first save the output of echo %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.






                                              share|improve this answer
























                                                0












                                                0








                                                0






                                                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 your go command, run type 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 your GOROOT, 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 your go command, run where go take the first line of output, and strip off the bingo.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 your GOROOT, first save the output of echo %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.






                                                share|improve this answer












                                                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 your go command, run type 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 your GOROOT, 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 your go command, run where go take the first line of output, and strip off the bingo.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 your GOROOT, first save the output of echo %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.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Dec 6 at 23:48









                                                Aaron Miller

                                                644




                                                644






























                                                    draft saved

                                                    draft discarded




















































                                                    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.




                                                    draft saved


                                                    draft discarded














                                                    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





















































                                                    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







                                                    Popular posts from this blog

                                                    Berounka

                                                    Sphinx de Gizeh

                                                    Different font size/position of beamer's navigation symbols template's content depending on regular/plain...