[英]How to setup VSCode for golang/go cmd module?
It works well for std
module ( golang/go root directory) on VSC.它适用于 VSC 上的
std
模块( golang/go根目录)。 However it doesn't work on cmd
module (opened from src/cmd
directory).但是它不适用于
cmd
模块(从src/cmd
目录打开)。 There were no code navigation, symbol search, and even any problems/errors reported.没有代码导航、符号搜索,甚至没有报告任何问题/错误。
Version info:版本信息:
vscode: 1.61.0 vscode-go: v0.28.1 vscode: 1.61.0 vscode-go: v0.28.1
Installed go tools:安装的 go 工具:
gopkgs go-outline gotests gomodifytags impl goplay dlv dlv-dap staticcheck gopls gopkgs go-outline gotests gomodifytags impl goplay dlv dlv-dap staticcheck gopls
Open VSC from $WORKSPACE/go
.从
$WORKSPACE/go
打开 VSC。 Follow the instruction of https://github.com/golang/tools/blob/master/gopls/doc/advanced.md#working-on-the-go-source-distribution as @hana mentioned:按照@hana 提到的https://github.com/golang/tools/blob/master/gopls/doc/advanced.md#working-on-the-go-source-distribution的说明进行操作:
Compile the Go binary.编译 Go 二进制文件。 Change working directory to
$WORKSPACE/go/src
and run ./make.bash
(or ./make.bat
for Windows cmd).将工作目录更改为
$WORKSPACE/go/src
并运行./make.bash
(或./make.bat
for Windows cmd)。 It will generate the $WORKSPACE/go/bin
directory.它将生成
$WORKSPACE/go/bin
目录。
Set "go.goroot"
to "${workspaceFolder}"
and install all Go tools required.将
"go.goroot"
设置为"${workspaceFolder}"
并安装所需的所有 Go 工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.