doubingjiu3199
2017-02-20 16:30
浏览 106
已采纳

如何使Golint在VS Code上按类型而不是保存方式运行?

I am using VS Code and the Go extension from lukehoban:

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

It seems like the golint is run when you save the file, is there a way for me to make golint run when I start typing? Usually linting happens when we type on other extensions and languages such as jslint, and tslint on VS Code. It would be nice to have the option to also be able to do this with golint.

What could I do to achieve this?

图片转代码服务由CSDN问答提供 功能建议

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

< a href =“ https://github.com/Microsoft/vscode-go” rel =“ nofollow noreferrer”> https://github.com/Microsoft/vscode-go

保存文件时好像好像在运行了刺针,当我开始输入文字时,有没有办法让我运行刺针? 当我们在VSlin上键入其他扩展名和语言(例如jslint和tslint)时,通常会发生linting。 可以选择还可以用棉lint做到这一点。

我该怎么办才能做到这一点?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douweinu8562 2017-02-21 18:13
    已采纳

    It seems like it's not possible at all.

    The only available configs regarding golint are:

      // Run Lint tool on save.
      "go.lintOnSave": true,
    
      // Specifies Lint tool name.
      "go.lintTool": "golint",
    
      // Flags to pass to Lint tool (e.g. ["-min_confidence=.8"])
      "go.lintFlags": [],
    

    Maybe you can hack this by changing these options though:

      // Controls auto save of dirty files. Accepted values:  "off", "afterDelay", "onFocusChange" (editor loses focus), "onWindowChange" (window loses focus). If set to "afterDelay", you can configure the delay in "files.autoSaveDelay".
      "files.autoSave": "off",
    
      // Controls the delay in ms after which a dirty file is saved automatically. Only applies when "files.autoSave" is set to "afterDelay"
      "files.autoSaveDelay": 1000,
    

    You could set files.autoSave to afterDelay and a lower files.autoSaveDelay.

    点赞 评论

相关推荐 更多相似问题