[Operator]vscode上golang的环境配置(Ubuntu18.04)

vscode、golang直接到官司网下载

打开vscode后安装golang的插件,变更配置

"files.autoSave": "afterDelay",
"go.useLanguageServer": true,
"go.goroot": "/usr/local/go",
"go.gopath": "/home/qulin/Documents/GoPorject",
"go.inferGopath": true,
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "gogetdoc",
"go.formatTool": "goimports",
"editor.fontSize": 15,

然后设置环境变量使用goproxy的代理进行依赖包的安装

~/.profile添加如下内容

export GOROOT=/usr/local/go
export GOPATH=/home/qulin/Documents/GoPorject
export GO111MODULE=on
export GOPROXY=https://goproxy.io
export PATH=$PATH:$GOROOT/bin

保存后source一下,再进入vscode ctrl+shift+p,输入go:intsll update too,将所有的插件都勾上----》回车

这样就可以进行coding了,enjoy ;)

猜你喜欢

转载自www.cnblogs.com/baylorqu/p/11866233.html