在版本升级到1.8后,go version命令显示旧版本号 [英] go version command shows old version number after update to 1.8

查看:471
本文介绍了在版本升级到1.8后,go version命令显示旧版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题非常多。我下载/安装了用于OS X的Go 1.8,但是当我去的时候

  $ go版本
go版本go1.7.5达尔文/ amd64

我的.bashrc看起来像下面那样

 #某些出口省略

NPM_PACKAGES = / Users /< me> /。npm-packages
NODE_PATH =$ NPM_PACKAGES / lib / node_modules:$ NODE_PATH

export PATH =〜/ Library / Python / 3.4 / bin:$ PATH
$ b $ export GOPATH = $ HOME / Go
export PATH = $ PATH:/ usr / local / go / bin

我的工作区位于名为Go 在我的家庭文件夹中。



我到目前为止检查过的内容:


  • 检查了/ usr / local / go / bin中的文件,并且VERSION文件状态为1.8,所以我知道安装成功了。

  • 还重新启动了我的终端会话,我甚至重新启动了我的电脑,以确保没有其他进程正在干扰它。 我使用Webstorm作为我的IDE,认可1.8作为工作版本
  • 这不是版本号本身的错误,因为我不能使用NextResultSet()sql功能在1.8版本中,我相信罪魁祸首可能是上述.bashrc文件中的错误配置,因为只有终端被困在旧版本中,但我无法弄清楚它有什么问题。

    解决方案

    Go的版本安装,否则你看不到 go版本go1.7.5 darwin / amd64 作为输出 go版本



    IDE可能具有更高级的检测Go安装的方法,其他只是扫描 PATH GOROOT (这就是您的IDE找到并建议更新的Go 1.8)的原因。



    执行,它会转到,然后您会看到旧的Go所在的位置。注意,在你的 .bashrc 中,你会附加适当的Go(删除它)(以及对它的引用)。

    bin 文件夹添加到 PATH end

      export PATH = $ PATH:/ usr / local / go / bin 

    这意味着如果 PATH 包含旧版Go安装的 bin 文件夹(很可能),用于执行 go 命令。


    Pretty much the title. I downloaded/installed Go 1.8 for OS X, but when I go

    $ go version
    go version go1.7.5 darwin/amd64
    

    My .bashrc look like the following

    # some exports omitted
    
    NPM_PACKAGES=/Users/<me>/.npm-packages
    NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
    
    export PATH=~/Library/Python/3.4/bin:$PATH
    
    export GOPATH=$HOME/Go
    export PATH=$PATH:/usr/local/go/bin
    

    My workspace is in a directory called "Go" in my home folder.

    What I have checked so far:

    • I've checked the files in /usr/local/go/bin, and the VERSION file states "1.8", so I know the installation was successful.

    • I have also renewed my terminal session, I even rebooted my pc to make sure no other processes were interfering with it.

    • I use Webstorm as my IDE, and it correctly recognized 1.8 as the working version

    • It's not a bug in the version number itself, as I can't use the "NextResultSet()" sql functionality, introduced in version 1.8

    I believe the culprit might be a wrong configuration in the .bashrc file above, as only the terminal is stuck on the old version, but I can't figure out what is wrong with it.

    解决方案

    You obviously have an old version of Go installed, else you couldn't see go version go1.7.5 darwin/amd64 as the output of go version.

    IDEs might have more advanced method of detecting Go installations other that simply scanning PATH and GOROOT (and that's why your IDE found and suggested the newer Go 1.8).

    Execute which go, and you'll see where your old Go resides. Remove it (and references to it).

    Note that in your .bashrc you're appending the proper Go bin folder to the end of PATH:

    export PATH=$PATH:/usr/local/go/bin
    

    Which means if PATH contains the bin folder of the old Go installation (very likely), that is used to execute the go command.

    这篇关于在版本升级到1.8后,go version命令显示旧版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆