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

如何使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?

  • 写回答

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵