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).

  1. make sure $gopath/bin in $path (windows: %gopath%\bin goes in %path%).
  2. run go -u golang.org/x/tools/cmd/goimports (you may have install mercurial).
  3. install sublime text , gosublime (or make sure you’ve got latest update if it’s installed).
  4. open gosublime user config/preference file (mac: ⌘. ⌘5 windows: ctrl+. ctrl+5). make sure keep command button down whole shortcut sequence.
  5. make this: {"fmt_cmd": ["goimports"]}

source


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -