zoukankan      html  css  js  c++  java
  • MacOS VSCode 安装 GO 插件失败问题解决

    0x00 问题重现

    Installing golang.org/x/tools/cmd/guru FAILED
    Installing golang.org/x/tools/cmd/gorename FAILED
    Installing golang.org/x/lint/golint FAILED
    Installing github.com/stamblerre/gocode FAILED
    
    4 tools failed to install.
    

    VS COde 打开 .go 文件会自动安装插件,但是出现了一些工具的下载失败。

    换上全局代理也无法下载。

    找了许多教程,但可能由于一些版本的问题,目录已经变更了,导致卡在这里许久。尤其是 github.com/stamblerre/gocode。

    0x01 解决

    下面的操作都是基于 $GOPATH 这个路径下,MacOS 中 go 的 $GOPATH 可以通过在终端键入go env查看 ​$GOPATH 位置。

    我的 $GOPATH 位置在 /Users/Apple/go ,注意要切换到你自己的 $GOPATH 中。

    1、创建目录 golang.orgx,并进入该目录中 clone 工具仓库。

    $ cd /Users/Apple/go/src
    $ mkdir -p golang.org/x && cd golang.org/x
    $ git clone https://github.com/golang/tools.git tools
    $ git clone https://github.com/golang/lint.git
    $ ls
    lint  tools
    

    2、回到 $GOPATH 目录,安装插件

    $ cd /Users/Apple/go
    $ sudo go install golang.org/x/tools/cmd/guru
    $ sudo go install golang.org/x/tools/cmd/gorename
    $ sudo go install golang.org/x/lint/golint
    

    3、创建目录 github.com,并进入该目录中 clone 工具仓库。

    $ cd /Users/Apple/go/src
    $ sudo mkdir -p github.com/stamblerre $$ cd github.com/stamblerre
    $ sudo git clone https://github.com/stamblerre/gocode.git
    $ ls
    gocode
    

    4、回到 $GOPATH 目录,安装插件

    $ cd /Users/Apple/go
    $ sudo go install github.com/stamblerre/gocode
    

    四个插件都安装完成之后,再用 VS Code 打开随意一个 .go 文件 ,就不会报安装失败的错误了。

  • 相关阅读:
    奇异值分解(SVD)与在降维中的应用
    拉格朗日乘子法&KKT条件
    有监督学习、无监督学习、半监督学习
    LSTM学习—Long Short Term Memory networks
    Ubuntu16.04+CUDA8.0+cuDNN5.1+Python2.7+TensorFlow1.2.0环境搭建
    激活函数
    C基础学习笔记
    Hive
    Fragment跳转至Activity片段随笔
    冒泡排序和选择排序
  • 原文地址:https://www.cnblogs.com/nnylee/p/11135527.html
Copyright © 2011-2022 走看看