HiveBrain v1.2.0
Get Started
← Back to all entries
patterngoCritical

Execute gofmt on file save in IntelliJ

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
savefileintellijgofmtexecute

Problem

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

Solution

Of course you can.

  • install File Watchers plugin



  • open "Preferences->Tools->File Watchers" & Add a new watcher



  • set File Type: Go, Program: the abosolute path of gofmt, Arguments: -w $FilePath$



  • click OK

Context

Stack Overflow Q#33774950, score: 149

Revisions (0)

No revisions yet.