vscode中远程环境Go插件不生效的问题

最近使用vscode远程到机器上出现GO插件无法使用的问题,查看定义跳转不生效。

关于GO插件下载的问题

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPRIVATE=*.corp.example.com

GO插件不生效需要在vscode中设置远程机器上的GOROOT以及GOPATH

如下是vscode中的json配置

{
    "workbench.editor.enablePreview": false,
    "vim.useCtrlKeys": false,
    "files.autoSave": "afterDelay",
    "editor.formatOnSave": true,
    "go.goroot": "/home/huangjiajia/soft/go",
    "go.gopath": "/home/huangjiajia/soft/go/jia"
}

远程机器上go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/huangjiajia/.cache/go-build"
GOENV="/home/huangjiajia/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="*.corp.example.com"
GONOSUMDB="*.corp.example.com"
GOOS="linux"
GOPATH="/home/huangjiajia/soft/go/jia"
GOPRIVATE="*.corp.example.com"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/home/huangjiajia/soft/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/huangjiajia/soft/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build325300216=/tmp/go-build -gno-record-gcc-switches"

你可能感兴趣的:(GO,vscode,golang)