使用 golang 调试器的 Visual Studio 代码与 gopath 路径代码不匹配?
我使用 Visual Studio Code IDE MAC OS构建了 golang 环境,然后安装了必要的工具:
go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-find-references
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
我曾经设置/Users/friends/gopath
过我的 gopath ,不久我改变了我的 gopath /Users/friends/Document/share/gopath
。我更改了 gopath ~/.bash_profile,关于Visual Studio 代码设置
go.gopath": "/Users/friends/Documents/VirtualMachine/share/gopath
当我调试我的代码时,它提示找不到文件/Users/friends/gopath/src/...../apiSGetChainsIds.go
,实际上文件存在。/Users/friends/Documents/VirtualMachine/share/gopath/src/..../apiSGetChainsIds.go
很明显调试器找到了以前的gopath
,是golang工具的错误吗?还是我错了?
我的用户设置是
{
"files.autoSave": "afterDelay",
//"go.buildOnSave": "package",
//"go.lintOnSave": "package",
//"go.vetOnSave": "package",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.formatOnSave": false,
"go.formatTool": "goreturns",
"editor.fontSize": 14,
"go.goroot": "/usr/local/Cellar/go/1.8.3/libexec",
"go.gopath": "/Users/friends/Documents/VirtualMachine/share/gopath"
}