英文:
golangci-lint not showing errors on vscode
问题
我正在尝试将golangci-lint与vscode集成。这是我的vscode设置文件:
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.liveErrors": {
"enabled": true,
"delay": 500
},
"go.lintOnSave": "workspace",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"diagnostics": true
}
然而,在vscode中没有显示任何错误/警告。最初是可以显示的,但突然消失了。另外,我知道linting工具实际上使用了许多其他的linters,比如errcheck
、ineffassign
等等,我需要单独安装它们吗?
英文:
I'm trying to integrate golangci-lint with vscode. This is my settings file in vscode
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"go.liveErrors": {
"enabled": true,
"delay": 500
},
"go.lintOnSave": "workspace",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
"diagnostics": true
}
However none of the errors/warnings show up on vscode. Initially it was showing up but suddenly disappeared. Also on another note, I know the linting tool in turn use a number of other linters like errcheck
ineffassign
and so on, do I have to install them separately ?
答案1
得分: 2
我遇到了类似的问题,我通过从配置中删除--fast
标志并通过VS Code插件重新运行linter,然后再添加回来来解决它。
我怀疑这与--fast
标志使用的缓存有关:
https://golangci-lint.run/usage/faq/#why-running-with---fast-is-slow-on-the-first-run
英文:
I had a similar problem and I solved it by removing --fast
flag from the configuration, and rerunning linter via VS Code plugin, then adding it back.
I suspect it had something to do with the cache the --fast
flag is using:
https://golangci-lint.run/usage/faq/#why-running-with---fast-is-slow-on-the-first-run
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论