安装golang

# 到官网下载二进制包https://golang.org/dl/ 或者 https://studygolang.com/dl  # 解压包tar -xvf go1.12.9.linux-amd64.tar.gz  # 移动到正常目录下sudo mv go /usr/local/  # 添加环境变量, 配置代理, 启用gomodsudo vim /etc/profile.d/golang.shexport PATH=$PATH:/usr/local/go/binexport GO111MODULE=onexport GOPROXY=https://goproxy.io  # 加载环境变量source /etc/profile.d/golang.sh  # 测试安装go version

安装vscode

到官网下载vscode https://code.visualstudio.com/
下载deb包双击安装或者dpkg -i 安装即可

安装vscode 的go插件

安装其他工具



如果因为墙原因无法安装,请翻墙,或者手动安装
https://github.com/Microsoft/vscode-go/wiki/Go-tools-that-the-Go-extension-depends-on
安装日志
Installing github.com/mdempsky/gocode SUCCEEDED
Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv SUCCEEDED
Installing github.com/stamblerre/gocode SUCCEEDED
Installing github.com/rogpeppe/godef SUCCEEDED
Installing github.com/sqs/goreturns SUCCEEDED
Installing golang.org/x/lint/golint SUCCEEDED
Installing github.com/cweill/gotests/... SUCCEEDED
Installing github.com/fatih/gomodifytags SUCCEEDED
Installing github.com/josharian/impl SUCCEEDED
Installing github.com/davidrjenni/reftools/cmd/fillstruct SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay SUCCEEDED
Installing github.com/godoctor/godoctor SUCCEEDED

配置vscode

{    "files.autoSave": "afterDelay",    "go.buildOnSave": "workspace",    "go.lintOnSave": "package",    "go.vetOnSave": "package",    "go.formatTool": "goreturns",    "go.goroot": "/usr/local/go",    "go.useLanguageServer": true,    "go.alternateTools": {      "go-langserver": "gopls",    },    "go.languageServerExperimentalFeatures": {      "format": true,      "autoComplete": true    },    "[go]": {        "editor.codeActionsOnSave": {            "source.organizeImports": true        },    }}
收藏 打印