go - 如何让 golint 在 VS Code 上按类型运行而不是在保存时运行?

标签 go visual-studio-code

我正在使用 VS Code 和来自 lukehoban 的 Go 扩展:

https://github.com/Microsoft/vscode-go

保存文件时似乎 golint 正在运行,有没有办法让 golint 在我开始输入时运行?当我们在其他扩展和语言(例如 VS Code 上的 jslint 和 tslint)上键入时,通常会发生 linting。如果能够选择也能够使用 golint 执行此操作,那就太好了。

我可以做些什么来实现这一目标?

最佳答案

Go 的这一面让我疯狂......

因此,我找到了一个名为“go.useLanguageServer”的选项(很可能我在早些时候发现了它,但出于某种原因,无论如何都不容易找到该选项)。

"go.useLanguageServer": true,

此外,还有这些选项:

"go.languageServerExperimentalFeatures": {
    "diagnostics": true,
    "documentLink": true
},
"go.liveErrors": {
    "enabled": true,
    "delay": 500,
},

关于go - 如何让 golint 在 VS Code 上按类型运行而不是在保存时运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42349678/

相关文章:

go - 如何动态添加一列到container.NewGridWithColumns()

go - 你如何在golang中返回一个非原始类型的变量

visual-studio-code - Visual Studio Code - 在多个页面的一行中使用数学运算更改特定整数的值

visual-studio-code - VsCode remote-ssh 在新计算机上不起作用

visual-studio-code - 在 Windows 10 上按 Ctrl+Shift+P 时 VS Code 未收到 "P"

visual-studio-code - Visual Studio Code 无法识别 Svelte 中的 SCSS

golang slice [ :] matches with the last element

linux - 如何从Windows部署Go程序到CentOS服务器

angular - 如何忽略 typescript 或 idm 错误?

json - golang 中的 "missing type in composite literal"