VS Code go 插件安装失败 r.declReader.Reset undefined

在安装完 VS Code 后开始安装 go 的插件发现有如下错误

wohu@wohu:~/GoCode/src$ go install github.com/nsf/gocode
# github.com/nsf/gocode
github.com/nsf/gocode/package_ibin.go:99: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)
github.com/nsf/gocode/package_ibin.go:148: undefined: io.SeekCurrent
github.com/nsf/gocode/package_ibin.go:152: undefined: io.SeekCurrent
github.com/nsf/gocode/package_ibin.go:214: r.declReader.Reset undefined (type bytes.Reader has no field or method Reset)

查阅相关资料后发现是由于使用

sudo apt-get insall golang-go

命令安装的 go 版本为 go 1.6 , 版本过低导致。 所以需要卸载这个版本再重新安装更新的版本。

wohu@wohu:~/GoCode/src$ sudo apt-get remove golang-go 
[sudo] password for wohu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  golang-1.6-go golang-1.6-race-detector-runtime golang-1.6-src
  golang-race-detector-runtime golang-src
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  golang-go
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 48.1 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 286275 files and directories currently installed.)
Removing golang-go (2:1.6-1ubuntu4) ...
Processing triggers for man-db (2.7.5-1) ...
                    
wohu@wohu:~/GoCode/src$ sudo apt-get remove golang-1.6-*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'golang-1.6-go' for glob 'golang-1.6-*'
Note, selecting 'golang-1.6-doc' for glob 'golang-1.6-*'
Note, selecting 'golang-1.6-race-detector-runtime' for glob 'golang-1.6-*'
Note, selecting 'golang-1.6-src' for glob 'golang-1.6-*'
Package 'golang-1.6-doc' is not installed, so not removed
The following packages will be REMOVED:
  golang-1.6-go golang-1.6-race-detector-runtime golang-1.6-src
  golang-race-detector-runtime golang-src
0 upgraded, 0 newly installed, 5 to remove and 6 not upgraded.
After this operation, 198 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 286249 files and directories currently installed.)
Removing golang-1.6-go (1.6.1-0ubuntu1) ...
Removing golang-race-detector-runtime (2:1.6-1ubuntu4) ...
Removing golang-1.6-race-detector-runtime (0.0+svn252922-0ubuntu1) ...
dpkg: warning: while removing golang-1.6-race-detector-runtime, directory '/usr/lib/go-1.6/src/runtime/race' not empty so not removed
Removing golang-src (2:1.6-1ubuntu4) ...
Removing golang-1.6-src (1.6.1-0ubuntu1) ...

Go 1.12 安装步骤参考以下链接:

https://blog.csdn.net/wohu1104/article/details/97965998

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值