golang + Atom 编程环境搭建

来源:互联网 发布:乐高moc软件 编辑:程序博客网 时间:2024/06/13 08:11

针对go get被墙的问题,解决方案有两种。

  1. 转而去github寻找源码,具体方法如下所述
  2. 继续使用go get,不过要为其设置代理。

针对方法1:
对应安装如下的软件包,

go get -v -u golang.org/x/tools/cmd/godoc

将命令修改为

cd $GOPATH/srcgit clone https://github.com/golang/tools

这是由于github.com存有golang.org的代码镜像,因而可以手动从github上面clone需要的工具包的源码,然后执行下面的命令进行安装

go build golang.org/x/tools/cmd/godoc 

其他的工具安装方法与上述方法类似。

针对方法二:
这里代理工具选择lantern。其代理IP地址为http://127.0.0.1:8787而不是 http://127.0.0.1:16823/
首先执行下面的方法为系统设置代理:

//windows 系统cmdset http_proxy=http://127.0.0.1:8787set https_proxy=https://127.0.0.1:8787
//ubuntu export http_proxy=http://127.0.0.1:8787export https_proxy=https://127.0.0.1:8787

其次,要为git工具设置代理:

git config --global http.proxy http://127.0.0.1:8787git config --global https.proxy https://127.0.0.1:8787

对应的取消命令为:

git config --global --unset http.proxy git config --global --unset https.proxy

之后,便可以使用go get命令来安装工具包。

0 0
原创粉丝点击