【发布时间】:2020-03-26 09:03:56
【问题描述】:
我想知道是否有人可以在 Mac 上使用 Vscode 分享他们对 Golang 的最佳设置。由于我不断遇到以下问题:
- 有时 gomft 不起作用。
- 在同一个包中定义的函数显示带有红色下划线警告,表示它未定义(但在运行时有效)
- 弹出以下消息
Your workspace is misconfigured: command-line-arguments has no metadata. Please see https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md for more information or file an issue (https://github.com/golang/go/issues/new) if you believe this is a mistake.
以下是我的 go 设置的一些信息:
- 版本:go1.13.4 darwin/amd64
- “settings.json”中的设置:
{
"window.zoomLevel": 1,
"workbench.iconTheme": "material-icon-theme",
"editor.accessibilitySupport": "off",
"go.useLanguageServer": true,
"go.formatTool": "gofmt",
"go.lintTool": "golangci-lint",
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
"explorer.confirmDragAndDrop": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"diffEditor.ignoreTrimWhitespace": false
}
- GOPATH 指向安装 Go 的文件夹
【问题讨论】:
-
这类问题有时也会发生在我身上。重新启动 VS Code 为我解决了问题。
标签: go visual-studio-code installation