3 回答

TA貢獻1818條經驗 獲得超3個贊
你可以試試這個設置。
"go.inferGopath": false,
"go.buildOnSave": "workspace",
"go.lintOnSave": "package",
"go.vetOnSave": "package",
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.formatTool": "goreturns",
"go.gocodeAutoBuild": false,
"go.useLanguageServer": true,
"go.alternateTools": {
"go-langserver": "gopls",
},
"go.languageServerExperimentalFeatures": {
"format": true,
"autoComplete": true
},
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},

TA貢獻1844條經驗 獲得超8個贊
我看到了同樣的問題,也使用golangci-lint了 lint 工具。當我查看 Go 擴展的輸出時(視圖 > 命令托盤 > 輸出:關注輸出視圖;然后在輸出視圖的下拉列表中選擇“Go”),我看到如下錯誤:
Error while running tool: /usr/local/bin/golangci-lint run --print-issued-lines=false
level=warning msg="[runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: [email protected]/pkg/example"
還有這個
level=error msg="Running error: buildssa: analysis skipped: errors in package: [/Users/tschaub/projects/pkg/example.go:6:15: undeclared name: SomethingIJustStartedTyping
第一個錯誤 ( assign: failed prerequisites) 在https://github.com/golangci/golangci-lint/issues/827中被記錄,并以關于更新到[email protected].
第二個錯誤 ( ) 已在https://github.com/golangci/golangci-lint/issues/896buildssa: analysis skipped出票,并且在我輸入此內容時收到新的評論。
升級到 v1.24.0可能無法解決問題,但聽起來它可能會生成更具描述性的輸出。
即使使用[email protected]也不能解決我的問題。每當我進入這種“錯誤配置”狀態時,我都需要退出 VSCode 并重新啟動它。我希望在工具趕上 go 模塊之后,事情會更加穩定/可靠。
- 3 回答
- 0 關注
- 317 瀏覽
添加回答
舉報