DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 302 forks source link

margo: Error: failed to fmt crashing SublimeText3 plugin_host #903

Closed tab1293 closed 5 years ago

tab1293 commented 5 years ago

Whenever I try to save an incorrectly formatted .go file, margo complains with this error:

margo: Error: failed to fmt /go/src/path/to/file.go: `goimports -srcdir /go/src/path/to/file.go`: exit status 2
error: plugin_host has exited unexpectedly, plugin functionality won't be available until Sublime Text has been restarted

In my terminal I can run goimports fine. Does this error seem like margo can't locate it? How else can I help debug this issue?

Edit: Including GoSublime's init message:

** 2019-01-07 21:23:51.326459 **:
GoSublime init r18.11.28-1 (0.002s)
|   install margo: no
|   install state: done
| sublime.version: 3176
| sublime.channel: stable
|       about.ann: a18.11.28-1
|   about.version: r18.11.28-1
|         version: r18.11.28-1
|        platform: osx-x64
|            ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.11.28-1_go1.11.2.exe (ok)
|          go.exe: /usr/local/Cellar/go/1.11.2/libexec/bin/go (ok)
|      go.version: go1.11.2
|          GOROOT: /usr/local/Cellar/go/1.11.2/libexec
|          GOPATH: ~/go
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  using shell env GO111MODULE=off
|                >  using shell env GOPATH=~/go
|                >  using shell env GOROOT=/usr/local/Cellar/go/1.11.2/libexec
|                >  using shell env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:~/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin:~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/bin:~/go/bin:~/bin:/usr/local/opt/go/bin:~/go/bin:/usr/local/bin:~/bin
|                >  go version: `go1.11.2` (raw version string `go1.11.2`)
|                >  shell bootstrap took 1.867s
|                >
--------------------------------
DisposaBoy commented 5 years ago

The exit 2 is probably a failure to find goimports. Pressing cmd+9 and typing which goimports should confirm that.

The crash is most like https://github.com/SublimeTextIssues/Core/issues/2327#issuecomment-425767504 which is supposedly fixed in the dev version of Sublime Text.

tab1293 commented 5 years ago

It was actually this on_save command that was causing the crash:

"on_save": [
        {"cmd": "gs_comp_lint"},
    ],

Removing that fixed my issue, I'm guessing that command could not be found.

Anyway I'll close this issue, thanks for the response :)