最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

VS?Code安裝go插件失敗原因分析以及解決方案

 更新時(shí)間:2022年09月07日 11:57:39   作者:一越王超  
vscode安裝go插件時(shí),由于各種原因,在安裝插件時(shí)總是失敗,下面這篇文章主要給大家介紹了關(guān)于VS?Code安裝go插件失敗原因分析以及解決的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下

問(wèn)題背景

VSCode是我們開(kāi)發(fā)go程序的常用工具,但是安裝VSCode成功后,創(chuàng)建一個(gè).go文件會(huì)有如下提示:

這個(gè)是vscode提示你需要安裝go插件,但是當(dāng)你點(diǎn)擊install all進(jìn)行安裝時(shí),發(fā)現(xiàn)會(huì)安裝失敗。

Installing 8 tools at D:\pragrams\go\bin
  gocode
  gopkgs
  go-outline
  go-symbols
  dlv
  godef
  goreturns
  golint
 
Installing github.com/mdempsky/gocode FAILED
Installing github.com/uudashr/gopkgs/cmd/gopkgs FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing github.com/derekparker/delve/cmd/dlv FAILED
Installing github.com/rogpeppe/godef FAILED
Installing github.com/sqs/goreturns FAILED
Installing golang.org/x/lint/golint FAILED
 
8 tools failed to install.
 
gocode:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/mdempsky/gocode
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/mdempsky/gocode: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/mdempsky/gocode: exec: "git": executable file not found in %PATH%
 
gopkgs:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/uudashr/gopkgs/cmd/gopkgs: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/uudashr/gopkgs/cmd/gopkgs: exec: "git": executable file not found in %PATH%
 
go-outline:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/ramya-rao-a/go-outline
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/ramya-rao-a/go-outline: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/ramya-rao-a/go-outline: exec: "git": executable file not found in %PATH%
 
go-symbols:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/acroca/go-symbols
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/acroca/go-symbols: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/acroca/go-symbols: exec: "git": executable file not found in %PATH%
 
dlv:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/derekparker/delve/cmd/dlv
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/derekparker/delve/cmd/dlv: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/derekparker/delve/cmd/dlv: exec: "git": executable file not found in %PATH%
 
godef:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/rogpeppe/godef
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/rogpeppe/godef: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/rogpeppe/godef: exec: "git": executable file not found in %PATH%
 
goreturns:
Error: Command failed: D:\install\go\bin\go.exe get -u -v github.com/sqs/goreturns
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/sqs/goreturns: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package github.com/sqs/goreturns: exec: "git": executable file not found in %PATH%
 
golint:
Error: Command failed: D:\install\go\bin\go.exe get -u -v golang.org/x/lint/golint
go: missing Git command. See https://golang.org/s/gogetcmd
package golang.org/x/lint/golint: exec: "git": executable file not found in %PATH%
go: missing Git command. See https://golang.org/s/gogetcmd
package golang.org/x/lint/golint: exec: "git": executable file not found in %PATH%

問(wèn)題原因

 在安裝go插件時(shí),會(huì)自動(dòng)更新很多依賴庫(kù)文件,都是從Github更新下來(lái),但是因?yàn)镚ithub的文件中,多有應(yīng)用go官網(wǎng)中的文件,因?yàn)橐恍┚W(wǎng)絡(luò)國(guó)內(nèi)無(wú)法訪問(wèn),網(wǎng)絡(luò)緣故,不能直接下載,導(dǎo)致安裝失敗。

解決方案

方案1:快速方案

核心是配置國(guó)內(nèi)下載源,我們需要修改如下兩個(gè)go的環(huán)境配置:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn

配置好兩個(gè)變量后,重新打開(kāi)VSCode,點(diǎn)擊右下方的install all重新安裝,

或者,在vscode中使用Ctrl+Shift+P,輸入>go:install,下面會(huì)自動(dòng)搜索相關(guān)命令,我們選擇Go:Install/Update Tools這個(gè)命令,選中所有插件,點(diǎn)擊確定進(jìn)行安裝。

問(wèn)題成功解決:

方案2:環(huán)境變量中配置

Windows在電腦 -> 系統(tǒng) -> 高級(jí)系統(tǒng)設(shè)置 -> 用戶環(huán)境中分別新建GO111MODULE和GOPROXY兩個(gè)用戶變量,其值如下圖所示:

GO111MODULE=on
GOPROXY=https://goproxy.cn,direct

或者也可以使用阿里源代理如下:

GO111MODULE=on
GOPROXY=https://mirrors.aliyun.com/goproxy/   
 

配置好之后,使用Windows + R調(diào)出終端,輸入cmd,通過(guò)go env命令查看go的環(huán)境變量配置是否設(shè)置成功。 

方案3:vscode中配置

vscode編輯器的設(shè)置在:文件 -> 首選項(xiàng) -> 設(shè)置 -> 用戶 -> 應(yīng)用程序 -> 代理服務(wù)器路徑下,如下圖所示:

總結(jié)

到此這篇關(guān)于VS Code安裝go插件失敗原因分析以及解決方案的文章就介紹到這了,更多相關(guān)VS Code安裝go插件失敗解決內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Go語(yǔ)言輕量級(jí)線程Goroutine用法實(shí)例

    Go語(yǔ)言輕量級(jí)線程Goroutine用法實(shí)例

    這篇文章主要介紹了Go語(yǔ)言輕量級(jí)線程Goroutine用法,實(shí)例分析了goroutine使用技巧,需要的朋友可以參考下
    2015-02-02
  • golang 切片的三種使用方式及區(qū)別的說(shuō)明

    golang 切片的三種使用方式及區(qū)別的說(shuō)明

    這篇文章主要介紹了golang 切片的三種使用方式及區(qū)別的說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2021-04-04
  • Golang配置解析神器go?viper使用詳解

    Golang配置解析神器go?viper使用詳解

    viper是一個(gè)很完善的Go項(xiàng)目配置解決方案,很多著名的開(kāi)源項(xiàng)目都在使用,比如Hugo,Docker都使用了該庫(kù),使用viper可以讓我們專注于自己的項(xiàng)目代碼,而不用自己寫那些配置解析代碼,本文給大家介紹Golang配置解析神器go?viper使用,感興趣的朋友一起看看吧
    2022-05-05
  • Go語(yǔ)言獲取本機(jī)邏輯CPU數(shù)量的方法

    Go語(yǔ)言獲取本機(jī)邏輯CPU數(shù)量的方法

    這篇文章主要介紹了Go語(yǔ)言獲取本機(jī)邏輯CPU數(shù)量的方法,實(shí)例分析了runtime庫(kù)的操作技巧,需要的朋友可以參考下
    2015-03-03
  • Golang 語(yǔ)言高效使用字符串的方法

    Golang 語(yǔ)言高效使用字符串的方法

    這篇文章主要介紹了Golang 語(yǔ)言高效使用字符串的方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-04-04
  • Go語(yǔ)言開(kāi)發(fā)發(fā)送Get和Post請(qǐng)求的示例

    Go語(yǔ)言開(kāi)發(fā)發(fā)送Get和Post請(qǐng)求的示例

    這篇文章主要介紹了Go語(yǔ)言開(kāi)發(fā)發(fā)送Get和Post請(qǐng)求的示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-07-07
  • golang使用swagger的過(guò)程詳解

    golang使用swagger的過(guò)程詳解

    這篇文章主要介紹了golang使用swagger的過(guò)程詳解,本文給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧
    2024-06-06
  • golang中字符串和數(shù)字轉(zhuǎn)換方法

    golang中字符串和數(shù)字轉(zhuǎn)換方法

    在Golang中,可以使用strconv包中的Itoa()和Atoi()函數(shù)進(jìn)行字符串與數(shù)字之間的轉(zhuǎn)換,Itoa()用于將數(shù)字轉(zhuǎn)換為字符串,Atoi()則用于將字符串轉(zhuǎn)換回?cái)?shù)字,本文介紹golang中字符串和數(shù)字轉(zhuǎn)換方法,感興趣的朋友一起看看吧
    2024-09-09
  • golang的序列化與反序列化的幾種方式

    golang的序列化與反序列化的幾種方式

    這篇文章主要介紹了golang的序列化與反序列化的幾種方式,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • 剖析Go編寫的Socket服務(wù)器模塊解耦及基礎(chǔ)模塊的設(shè)計(jì)

    剖析Go編寫的Socket服務(wù)器模塊解耦及基礎(chǔ)模塊的設(shè)計(jì)

    這篇文章主要介紹了Go的Socket服務(wù)器模塊解耦及日志和定時(shí)任務(wù)的模塊設(shè)計(jì),舉了一些Go語(yǔ)言編寫的服務(wù)器模塊的例子,需要的朋友可以參考下
    2016-03-03

最新評(píng)論

安溪县| 沙河市| 新丰县| 清丰县| 阿克苏市| 自治县| 西充县| 丰县| 大埔区| 伊春市| 夹江县| 九龙县| 托克逊县| 江安县| 高台县| 磴口县| 穆棱市| 阳泉市| 克什克腾旗| 漳浦县| 新密市| 醴陵市| 黎城县| 岐山县| 绥宁县| 宁河县| 泸定县| 白城市| 绥滨县| 东乡族自治县| 资兴市| 乌兰察布市| 出国| 常宁市| 高雄县| 卢氏县| 麻栗坡县| 桂东县| 盐山县| 桐庐县| 湘潭市|