dqudtskm49788 2015-11-18 08:24
浏览 438
已采纳

对保存在IntelliJ中的文件执行gofmt

I use IntelliJ with the Golang plugin. Is it possible to configure the IDE to execute gofmt on file save?

  • 写回答

3条回答 默认 最新

  • douzhi2760 2015-11-18 09:52
    关注

    Of course you can.

    1. install File Watchers plugin
    2. open "Preferences->Tools->File Watchers" & Add a new watcher
    3. set File Type: Go, Program: the abosolute path of gofmt, Arguments: -w $FilePath$
    4. click OK

    enter image description here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?