Linux vscode基本配置以及golang插件安装
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
背景
vscode也许是现在最流行的代码编辑器了吧,主要是还能映射其他代码编辑器的快捷键,比如vim、sublime text等。可是由于网络原因吧【被墙】,我在安装go插件的总会遇到失败。
环境
Ubuntu
设置中文菜单栏
当我们到vscode官网下载ded包,安装好后vscode是英文菜单,如果想设置为中文,我们可以先下载中文拓展插件,然后修改配置文件
1、安装中文拓展插件
2、修改配置文件
按组合键Ctrl + Shift + P
,在输入框中输入 configure
找到语言设置选项
修改locale.json
配置文件
保存从新启动vscode后菜单栏就是中文了
安装vscode golang第三方包/插件
按组合键Ctrl + Shift + P
,在输入框中输入go: install
找到下图红框选项
勾选所有推荐的go第三方包确认安装
等待许久后提示我一个都没有安装成功【懊恼吧…】
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 golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/derekparker/delve/cmd/dlv FAILED
Installing github.com/rogpeppe/godef FAILED
Installing golang.org/x/tools/cmd/godoc FAILED
Installing github.com/sqs/goreturns FAILED
Installing github.com/golang/lint/golint FAILED
Installing github.com/cweill/gotests/... FAILED
Installing github.com/fatih/gomodifytags FAILED
Installing github.com/josharian/impl FAILED
Installing github.com/davidrjenni/reftools/cmd/fillstruct FAILED
Installing github.com/haya14busa/goplay/cmd/goplay FAILED
就是各种google,发现好像都没有很好很全的解决这个问题,都是东凑西凑才得以解决,所以记录下解决方法
1、在GOPATH
目录下创建必要两个目录
$ mkdir -p github.com/golang
$ mkdir -p golang.org/x
2、克隆golang官方的tools包到上一步创建的两个目录
$ git clone https://github.com/golang/tools.git github.com/golang/tools
$ git clone https://github.com/golang/tools.git golang.org/x/tools
注:如果你发现克隆代码非常慢,而你电脑又可以翻墙,那快把终端也设置socks5代理吧
3、安装第三方包
$ go install github.com/mdempsky/gocode
$ go install github.com/uudashr/gopkgs/cmd/gopkgs
$ go install github.com/ramya-rao-a/go-outline
$ go install github.com/acroca/go-symbols
$ go install golang.org/x/tools/cmd/guru
$ go install golang.org/x/tools/cmd/gorename
$ go install github.com/derekparker/delve/cmd/dlv
$ go install github.com/rogpeppe/godef
$ go install golang.org/x/tools/cmd/godoc
$ go install github.com/sqs/goreturns
$ go install github.com/golang/lint/golint
$ go install github.com/cweill/gotests/gotests
$ go install github.com/fatih/gomodifytags
$ go install github.com/josharian/impl
$ go install github.com/davidrjenni/reftools/cmd/fillstruct
$ go install github.com/haya14busa/goplay/cmd/goplay
4、更改下用户的配置文件
点击文件
->首选项
->设置
,在输入框中输入go
,打开配置文件
添加以下设置
# vscode好像还不支持socks5代理
# https://code.visualstudio.com/docs/setup/network
"http.proxy": "http://127.0.0.1:1080",
"http.proxyStrictSSL": false,
"go.goroot": "/usr/local/go",
"go.gopath": "/home/tab/go",
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "gogetdoc",
"go.inferGopath": true
到此,vscode golang的开发环境配置基本完成了。
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献3条内容
所有评论(0)