go - Run goimports on save in Sublime Text? -
in sublime text 3, plugins gosublime
, goimports
installed.
i'm having trouble having goimports
run on file automatically everytime save.
here's tried :
my gosublime settings set :
{ "env": {"gopath": "/home/nicolas/.go", "path": "$gopath/bin:$path" }, //"fmt_cmd": ["goimports"] }
when save these settings, code gets formatted imports not added. nothing surprising far.
if hit ctrl+shift+p goimports, imports added expected.
now problem is, when uncomment previous line have these settings :
{ "env": {"gopath": "/home/nicolas/.go", "path": "$gopath/bin:$path" }, "fmt_cmd": ["goimports"] }
not not add imports, no other formatting gets done anymore.
any idea went wrong ?
i'm using linux (ubuntu).
- make sure $gopath/bin in $path (windows: %gopath%\bin goes in %path%).
- run go -u golang.org/x/tools/cmd/goimports (you may have install mercurial).
- install sublime text , gosublime (or make sure you’ve got latest update if it’s installed).
- open gosublime user config/preference file (mac: ⌘. ⌘5 windows: ctrl+. ctrl+5). make sure keep command button down whole shortcut sequence.
- make this:
{"fmt_cmd": ["goimports"]}
Comments
Post a Comment