我安裝了 staticcheck,但它并沒有告訴我 Visual Studio Code 中的任何問題。
我將我的 linter 配置為使用 staticcheck,然后我在 Internet 上到處查看。它仍然不起作用。
這是我的settings.json檔案的一部分:
{
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"go.lintTool": "staticcheck",
"go.lintFlags": [],
"go.testFlags": ["-v"],
"go.toolsManagement.autoUpdate": true,
"editor.codeActionsOnSave": { "source.fixAll.eslint": true }
}
我已經嘗試"-check=all"在go.lintFlags. 我重新加載了我的 Visual Studio Code,但它仍然無法正常作業。
當我查看他們談論的官方網站時staticcheck.conf,但我不明白,因為staticcheck.conf我的系統上有多個檔案。
uj5u.com熱心網友回復:
您不需要"go.lintTool": "staticcheck",,因為這是 ( staticcheck) 中的默認 linting 工具vscode-go。
如果您啟用了語言服務,則需要staticcheck 使用
"gopls": { "ui.diagnostic.staticcheck": true }.
作為替代方案,您可以設定golangci-lint為您的 linter 并將staticcheck其上交。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/424136.html
上一篇:我不太了解golang頻道
下一篇:Goroutines導致死鎖
