8

解决 VS Code 安装 Go 插件失败的问题

 3 years ago
source link: http://i.lckiss.com/?p=7241
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

解决 VS Code 安装 Go 插件失败的问题

2021-07-19

最近在学 Go,毕竟 Go 的应用太广了,几乎大多数开源平台都是 Go 构建的,同时对芯片架构也足够友好,交叉编译是值得玩的。

对于初学者,用不着 IDE,用 VS Code 就够了,装一个插件:

完成后可以新建一个文件运行下 HelloWord:

package main

import f "fmt" // Package implementing formatted I/O.

func main() {
    f.Printf("Καλημέρα κόσμε; or こんにちは 世界\n")
}

然后右下角会提示需要安装一些组件,点击 install all 后日志一堆 failed,后来了解到 https://goproxy.io/zh/

按说明配置下环境变量:

# 配置 GOPROXY 环境变量
export GOPROXY=https://goproxy.io,direct
# 还可以设置不走 proxy 的私有仓库或组,多个用逗号相隔(可选)
export GOPRIVATE=git.mycompany.com,github.com/my/private

回车完事就再安装就可以成功了。

相关插件的手动安装命令:

go get -u -v github.com/uudashr/gopkgs/v2/cmd/gopkgs
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/cweill/gotests
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/josharian/impl
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/go-delve/delve/cmd/dlv
go get -u -v github.com/go-delve/delve/cmd/dlv@master

  • 2021051300031389.jpg

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK