VSCode安裝go相關(guān)插件失敗的簡(jiǎn)單解決方案
1. GO環(huán)境信息
C:\Users\home>go version
go version go1.18.2 windows/amd64
C:\Users\home>
安裝go插件之后,VSCode開(kāi)始寫(xiě)代碼會(huì)提示安裝其他插件,錯(cuò)誤信息如下:
Installing 8 tools at C:\Go\repository\bin in module mode.
gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
go-outline
Installing github.com/cweill/gotests/gotests@latest FAILED
Installing github.com/fatih/gomodifytags@latest FAILED
Installing github.com/josharian/impl@latest FAILED
Installing github.com/go-delve/delve/cmd/dlv@latest FAILED
Installing github.com/haya14busa/goplay/cmd/goplay@latest FAILED
Installing github.com/go-delve/delve/cmd/dlv@latest FAILED
Installing honnef.co/go/tools/cmd/staticcheck@latest FAILED
Installing honnef.co/go/tools/cmd/staticcheck@latest FAILED
Installing golang.org/x/tools/gopls@latest FAILED
Installing github.com/ramya-rao-a/go-outline@latest FAILED
無(wú)法下載插件只能通過(guò)設(shè)置GOPROXY代理解決
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/
修改之后
Installing 8 tools at C:\Go\repository\bin in module mode.
gotests
gomodifytags
impl
goplay
dlv
staticcheck
gopls
go-outline
Installing github.com/cweill/gotests/gotests@latest (C:\Go\repository\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags@latest (C:\Go\repository\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl@latest (C:\Go\repository\bin\impl.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (C:\Go\repository\bin\dlv.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay@latest (C:\Go\repository\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (C:\Go\repository\bin\dlv.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (C:\Go\repository\bin\staticcheck.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (C:\Go\repository\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls@latest (C:\Go\repository\bin\gopls.exe) SUCCEEDED
1 tools failed to install.
impl: failed to install impl(github.com/josharian/impl@latest): Error: Command failed: C:\Go\bin\go.exe install -v github.com/josharian/impl@latest
go: github.com/josharian/impl@latest: module github.com/josharian/impl: reading https://mirrors.aliyun.com/goproxy/github.com/josharian/impl/@v/list: 404 Not Found
Installing golang.org/x/tools/gopls@latest (C:\Go\repository\bin\gopls.exe) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline@latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "C:\\Go\\bin\\go.exe install -v github.com/ramya-rao-a/go-outline@latest",
"stdout": "",
"stderr": "go: github.com/ramya-rao-a/go-outline@latest: no matching versions for query \"latest\"\n"
}
1 tools failed to install.
go-outline: failed to install go-outline(github.com/ramya-rao-a/go-outline@latest): Error: Command failed: C:\Go\bin\go.exe install -v github.com/ramya-rao-a/go-outline@latest
go: github.com/ramya-rao-a/go-outline@latest: no matching versions for query "latest"
還是有一個(gè)報(bào)錯(cuò),未能成功安裝全部插件,然后切換到%GOPATH%\pkg\mod\github.com目錄,例如
C:\Go\repository\pkg\mod\github.com
執(zhí)行如下命令
git clone https://github.com/josharian/impl
然后切換到GOPATH目錄,執(zhí)行如下命令
PS C:\go\repository> go install github.com/josharian/impl@latest PS C:\go\repository> go install github.com/ramya-rao-a/go-outline@latest go: downloading github.com/ramya-rao-a/go-outline v0.0.0-20210608161538-9736a4bde949 go: downloading golang.org/x/tools v0.1.1 PS C:\go\repository>
上述命令結(jié)束之后,重啟VSCode,這下寫(xiě)Go代碼就沒(méi)有問(wèn)題了。
總結(jié)
到此這篇關(guān)于VSCode安裝go相關(guān)插件失敗的簡(jiǎn)單解決方案的文章就介紹到這了,更多相關(guān)VSCode安裝go插件失敗內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
一文帶你了解Go語(yǔ)言中鎖特性和實(shí)現(xiàn)
Go語(yǔ)言中的sync包主要提供的對(duì)并發(fā)操作的支持,標(biāo)志性的工具有cond(條件變量)?once?(原子性)?還有?鎖,本文會(huì)主要向大家介紹Go語(yǔ)言中鎖的特性和實(shí)現(xiàn),感興趣的可以了解下2024-03-03go語(yǔ)言程序cpu過(guò)高問(wèn)題排查的方法詳解
使用golang進(jìn)行復(fù)雜的組合運(yùn)算,導(dǎo)致CPU占用率非常高,下面這篇文章主要給大家介紹了關(guān)于go語(yǔ)言程序cpu過(guò)高問(wèn)題排查的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-04-04一文搞懂如何實(shí)現(xiàn)Go 超時(shí)控制
這篇文章主要介紹了一文搞懂如何實(shí)現(xiàn)Go 超時(shí)控制,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03Go語(yǔ)言數(shù)據(jù)類(lèi)型詳細(xì)介紹
這篇文章主要介紹了Go語(yǔ)言數(shù)據(jù)類(lèi)型詳細(xì)介紹,Go語(yǔ)言數(shù)據(jù)類(lèi)型包含基礎(chǔ)類(lèi)型和復(fù)合類(lèi)型兩大類(lèi),下文關(guān)于這兩類(lèi)型的相關(guān)介紹,需要的小伙伴可以參考一下2022-03-03golang 對(duì)私有函數(shù)進(jìn)行單元測(cè)試的實(shí)例
這篇文章主要介紹了golang 對(duì)私有函數(shù)進(jìn)行單元測(cè)試的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2021-05-05Go語(yǔ)言實(shí)現(xiàn)控制臺(tái)輸入&生成隨機(jī)數(shù)詳解
這篇文章主要介紹了Go語(yǔ)言如何實(shí)現(xiàn)控制臺(tái)輸入&生成隨機(jī)數(shù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-05-05golang中的三個(gè)點(diǎn) ''...''的用法示例詳解
這篇文章主要介紹了golang中的三個(gè)點(diǎn) '...' 的用法示例詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11