成功安装vscode中go的相关插件(详细教程)
让你成功安装vscode中go的相关插件
注意:该演⽰环境是windows环境,linux和mac环境操作思路⼀样
vscode中有很多go的相关插件,⾮常好⽤如下:
gocode
gopkgs
go-outline
go-symbols
guru
gorename
gomodifytags
goplay
impl
godef
goreturns
golint
gotests
dlv
但是由于各种原因,这些插件⽆法安装,甚⾄你翻墙之后发现也还是⽆法安装,加上最近翻墙被限制的这么严格,所以总结了如下⽅法,让你在不翻墙的情况下还能将这些插件安装成功,下图是我直接
通过vscode安装提⽰的错误:
貌似运⽓还不错,还安装成功了⼏个,但是⼤部分还是没有安装成功,下⾯是详细的安装⽇志:
Installing 14 tools at D:\go_project\bin
gocode
gopkgs
go-outline
go-symbols
guru
gorename
gomodifytags
goplay
impl
godef
goreturns
golint
gotests
dlv
/nsf/gocode SUCCEEDED
/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
/ramya-rao-a/go-outline FAILED
/acroca/go-symbols FAILED
/x/tools/cmd/guru FAILED
/x/tools/cmd/gorename FAILED
/fatih/gomodifytags SUCCEEDED
/haya14busa/goplay/cmd/goplay SUCCEEDED
/josharian/impl FAILED
/rogpeppe/godef SUCCEEDED
/sqs/goreturns FAILED
/golang/lint/golint FAILED
/cweill/gotests/... FAILED
/derekparker/delve/cmd/dlv SUCCEEDED
8 tools failed to install.
go-outline:
Error: Command failed: D:\Go\ get -u -/ramya-rao-a/go-outline
Fetching /x/tools/go/buildutil?go-get=1
https fetch failed: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau conne /x/tools/go/buildutil: unrecognized import path "/x/tools/go/buildutil" (https fetch: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party /ramya-rao-a/go-outline (download)
Fetching /x/tools/go/b十大元帅是哪些人
uildutil?go-get=1
https fetch failed: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau conne /x/tools/go/buildutil: unrecognized import path "/x/tools/go/buildutil" (https fetch: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connecti
on attempt failed becau the connected party di go-symbols:
Error: Command failed: D:\Go\ get -u -/acroca/go-symbols
Fetching /x/tools/go/buildutil?go-get=1
https fetch failed: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed bec /x/tools/go/buildutil: unrecognized import path "/x/tools/go/buildutil" (https fetch: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party /acroca/go-symbols (download)
Fetching /x/tools/go/buildutil?go-get=1
https fetch failed: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau conne /x/tools/go/buildut
il: unrecognized import path "/x/tools/go/buildutil" (https fetch: Get /x/tools/go/buildutil?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party di guru:
Error: Command failed: D:\Go\ get -u -/x/tools/cmd/guru
Fetching /x/tools/cmd/guru?go-get=1
https fetch failed: Get /x/tools/cmd/guru?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connec /x/tools/cmd/guru: unrecognized import path "/x/tools/cmd/guru" (https fetch: Get /x/tools/cmd/guru?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did no Fetching /x/tools/cmd/guru?go-get=1
https fetch failed: Get /x/tools/cmd/guru?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connec /x/tools/cmd/gur
u: unrecognized import path "/x/tools/cmd/guru" (https fetch: Get /x/tools/cmd/guru?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did no gorename:
Error: Command failed: D:\Go\ get -u -/x/tools/cmd/gorename
Fetching /x/tools/cmd/gorename?go-get=1
https fetch failed: Get /x/tools/cmd/gorename?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau c /x/tools/cmd/gorename: unrecognized import path "/x/tools/cmd/gorename" (https fetch: Get /x/tools/cmd/gorename?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the conne Fetching /x/tools/cmd/gorename?go-get=1
https fetch failed: Get /x/tools/cmd/gorename?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau c /x/tools/cmd/gorenam
e: unrec椅子怎么画
ognized import path "/x/tools/cmd/gorename" (https fetch: Get /x/tools/cmd/gorename?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the conne impl:
Error: Command failed: D:\Go\ get -u -/josharian/impl
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /x/tools/imports: unrecognized import path "golan房屋租赁合同电子版免费
g/x/tools/imports" (https fetch: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not /josharian/impl (download)
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connec
tex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /x/tools/imports: unrecognized import path "/x/tools/imports" (https fetch: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not prop goreturns:
Error: Command failed: D:\Go\ get -u -/sqs/goreturns
Fetching /sqs/goreturns?go-get=1
Parsing meta tags from /sqs/goreturns?go-get=1 (status code 200)
get "/sqs/goreturns": found meta aImport{Prefix:"/sqs/goreturns", VCS:"git", RepoRoot:"/sqs/goreturns"} at /sqs/goreturns?go-get=1
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/impo驯龙高手观后感
rts?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /x/tools/imports: unrecognized import path "/x/tools/imports" (https fetch: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not prop Fetching /sqs/goreturns?go-get=1
Parsing meta tags from /sqs/goreturns?go-get=1 (status code 200)
get "/sqs/goreturns": found meta aImport{Prefix:"/sqs/goreturns", VCS:"git", RepoRoot:"/sqs/goreturns"} at /sqs/goreturns?go-get=1
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: c一心一意造句
onnectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /x/tools/imports: unrecognized import path "/x/tools/imports" (https fetch: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not prop golint:
Error: Command failed: D:\Go\ get -u -/golang/lint/golint
Fetching /x/tools/go/gcexportdata?go-get=1
https fetch failed: Get /x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau /x/tools/go/gcexportdata: unrecognized import path "/x/tools/go/gcexportdata" (https fetch: Get /x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the /golang/lint (download)
Fetching /x/tools/go/gcexportdata?go-get=1
https fetch failed: Get /x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau /x/tools/go/gcexportdata: unrecognized import path "/x/tools/go/gcexportdata" (https fetch: Get /x/tools/go/gcexportdata?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the co gotests:
Error: Command failed: D:\Go\ get -u -/cweill/gotests/...
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/imports?说帘
go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /cweill/gotests
/x/tools/imports: unrecognized import path "/x/tools/imports" (https fetch:
Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not /cweill/gotests (download)
Fetching /x/tools/imports?go-get=1
https fetch failed: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not properly respond after a period of time, or established connection failed becau connecte /cweill/gotests
/x/tools/imports: unrecognized import path "/x/tools/imports" (https fetch: Get /x/tools/imports?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed becau the connected party did not prop 其实去src⽬录下看的话,是下载成功了,但是没有安装成功,并且我们也可以看出有⼏个是可以直接安装成功的
解决⽅法
关于go开发⽬录的结构这⾥不做过多解释,之前已经说过了
进⾏如下命令进⾏⽬录切换:
cd %GOPATH%\\golang
我这⾥的GOPATH是在D:\go_project
如果src⽬录下⾯没有\golang请⾃⾏创建
完成⽬录切换后,开始下载插件包:
当下载完成后,你会发现%GOPATH%\\golang多了⼀个tools⽬录
需要把tools⽬录下的所有⽂件拷贝到%GOPATH%\ \tools下,如果没有⾃⾏创建
当然如果你是windows环境,如果你当前是在%GOPATH%\ \tools
⽬录下,你可以直接使⽤如下命令进⾏拷贝:
xcopy /s /e %GOPATH%\\golang\tools
关于这个命令的使⽤可以具体百度查看,如果对该命令不熟悉就⼿动拷贝,直接将你下载的tools⽬录下的所有⽂件拷贝到%GOPATH%\ \tools⽬录下
经过多次测试,插件中有⼏个其实不⽤翻墙或其他⽅法就可以安装成功:
下⾯安装⽆法安装的插件
开始安装:
切换到GOPATH⽬录下,执⾏相关的go install 命令
go /ramya-rao-a/go-outline
go /acroca/go-symbols
go /x/tools/cmd/guru
go /x/tools/cmd/gorename
go /josharian/impl
go /rogpeppe/godef
go /sqs/goreturns
go /golang/lint/golint
go /cweill/gotests/gotests
这样vscode下go开发需要安装的插件十五天打一个字
都已经安装成功
总结
到此这篇关于成功安装vscode中go的相关插件的详细教程的⽂章就介绍到这了,更多相关vscode安装go插件内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!