[go]go环境安装-解决安装包不能访问golang.org问题
Posted iiiiiher
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[go]go环境安装-解决安装包不能访问golang.org问题相关的知识,希望对你有一定的参考价值。
安装go和vscode
vscode插件列表选择go,安装即可,其他插件暂不安装
手动安装一些vscode配套的调试工具等
直接vscode-go,然后点下面的go-tools就能找到
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/acroca/go-symbols
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/zmb3/gogetdoc
go get -u -v golang.org/x/lint/golint
go get -u -v github.com/fatih/gomodifytags
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/josharian/impl
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/alecthomas/gometalinter
gometalinter --install
注: 这里golang.org是没法访问的,所以需要摘出这些url
- 这部分包通过golang git提供的mirro库来下载安装:https://github.com/golang就有
go get -d golang.org/x/tools/cmd/godoc
go get -d golang.org/x/lint/golint
go get -d golang.org/x/tools/cmd/gorename
go get -d golang.org/x/tools/cmd/goimports
go get -d golang.org/x/tools/cmd/guru
使用这些命令(装一些常见的包go net/text/sys/sync/crypto/tools/lint)
mkdir -pv $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/lint.git
- 正常剩下的这部分包
go get -d github.com/ramya-rao-a/go-outline
go get -d github.com/acroca/go-symbols
go get -d github.com/mdempsky/gocode
go get -d github.com/rogpeppe/godef
go get -d github.com/zmb3/gogetdoc
go get -d github.com/fatih/gomodifytags
go get -d sourcegraph.com/sqs/goreturns
go get -d github.com/cweill/gotests/...
go get -d github.com/josharian/impl
go get -d github.com/haya14busa/goplay/cmd/goplay
go get -d github.com/uudashr/gopkgs/cmd/gopkgs
go get -d github.com/davidrjenni/reftools/cmd/fillstruct
go get -d github.com/alecthomas/gometalinter
~/go/src/golang.org/x $: ls
crypto lint net sync sys text tools
调试工具安装
- 选择对应的平台下载
go get -d github.com/go-delve/delve/cmd/dlv
执行安装
- 安装
go get github.com/ramya-rao-a/go-outline
go get github.com/acroca/go-symbols
go get github.com/mdempsky/gocode
go get github.com/rogpeppe/godef
go get github.com/zmb3/gogetdoc
go get github.com/fatih/gomodifytags
go get sourcegraph.com/sqs/goreturns
go get github.com/cweill/gotests/...
go get github.com/josharian/impl
go get github.com/haya14busa/goplay/cmd/goplay
go get github.com/uudashr/gopkgs/cmd/gopkgs
go get github.com/davidrjenni/reftools/cmd/fillstruct
go get github.com/alecthomas/gometalinter
go get github.com/go-delve/delve/cmd/dlv
- 执行安装
gometalinter --install
以上是关于[go]go环境安装-解决安装包不能访问golang.org问题的主要内容,如果未能解决你的问题,请参考以下文章