windows配置步骤
- step1:新建D:/mygo文件夹存放第三方库,为了防止污染go源码,官方的设定
- step2:编辑系统环境变量
1.新建 GOROOT D:/go
2.新建 GOPATH D:/mygo
3.新建 GOBIN D:/mygo/bin
4.在path末端加上 %GOROOT%/bin - step3: 去官网https://golang.google.cn/dl/下载gox.xx.x.windows-amd64.zip解压到GOROOT
- step4:vscode添加go插件
- step5:安装go插件依赖的工具
执行最下方安装脚本是发生这种以下情况下最直接的解决方法,开始时尝试过设置代理的方法,但依旧无法解决
Fetching https://golang.org/x/tools/go/gcexportdata?go-get=1
https fetch failed: Get https://golang.org/x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package golang.org/x/tools/go/gcexportdata: unrecognized import path "golang.org/x/tools/go/gcexportdata" (https fetch: Get https://golang.org/x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
安装脚本
mkdir D:/mygo/src
cd D:/mygo/src
git clone https://github.com/golang/tools.git ./golang.org/x/tools
git clone https://github.com/golang/lint.git ./golang.org/x/lint
git clone https://github.com/mdempsky/gocode.git ./github.com/mdempsky/gocode
git clone https://github.com/karrick/godirwalk.git ./github.com/karrick/godirwalk
git clone https://github.com/pkg/errors.git ./github.com/pkg/errors
git clone https://github.com/golang/xerrors.git ./golang.org/x/xerrors
git clone https://github.com/golang/sync.git ./golang.org/x/sync
git clone https://github.com/skratchdot/open-golang.git ./github.com/skratchdot/open-golang
git clone https://github.com/uudashr/gopkgs.git ./github.com/uudashr/gopkgs
git clone https://github.com/ramya-rao-a/go-outline.git ./github.com/ramya-rao-a/go-outline
git clone https://github.com/acroca/go-symbols.git ./github.com/acroca/go-symbols
git clone https://github.com/go-delve/delve.git ./github.com/go-delve/delve
git clone https://github.com/stamblerre/gocode.git ./github.com/stamblerre/gocode
git clone https://github.com/rogpeppe/godef.git ./github.com/rogpeppe/godef
git clone https://github.com/cweill/gotests.git ./github.com/cweill/gotests
git clone https://github.com/fatih/gomodifytags.git ./github.com/fatih/gomodifytags
git clone https://github.com/josharian/impl.git ./github.com/josharian/impl
git clone https://github.com/davidrjenni/reftools.git ./github.com/davidrjenni/reftools
git clone https://github.com/haya14busa/goplay.git ./github.com/haya14busa/goplay
git clone https://github.com/godoctor/godoctor.git ./github.com/godoctor/godoctor
go install github.com/mdempsky/gocode
go install github.com/uudashr/gopkgs/cmd/gopkgs
go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
go install github.com/go-delve/delve/cmd/dlv
go install github.com/rogpeppe/godef
go install golang.org/x/tools/cmd/goimports
go install golang.org/x/lint/golint
go install golang.org/x/tools/cmd/gopls
go install github.com/cweill/gotests/gotests
go install github.com/fatih/gomodifytags
go install github.com/josharian/impl
go install github.com/davidrjenni/reftools/cmd/fillstruct
go install github.com/haya14busa/goplay/cmd/goplay
go install github.com/godoctor/godoctor
go install golang.org/x/tools/gopls
有疑问加站长微信联系(非本文作者)
![](https://static.golangjob.cn/static/img/footer.png?imageView2/2/w/280)