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

GoSublime on saves not occurring - Margo Panic #688

Closed jhurwich closed 5 years ago

jhurwich commented 8 years ago

None of the GoSublime onsave functionality appears to be working for me. Please find the GoSublime Sanity Check results attached:

gosublime-sanity.txt

jhurwich commented 8 years ago

{

// you may set specific environment variables here
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
// in values, $PATH and ${PATH} are replaced with
// the corresponding environment(PATH) variable, if it exists.
"env": {"GOPATH": "$HOME/Documents/Projects/gocode"},

"fmt_cmd": ["goimports"],

// enable comp-lint, this will effectively disable the live linter
"comp_lint_enabled": true,

// list of commands to run
"comp_lint_commands": [
    // run `golint` on all files in the package
    // "shell":true is required in order to run the command through your shell (to expand `*.go`)
    // also see: the documentation for the `shell` setting in the default settings file ctrl+dot,ctrl+4
    {"cmd": ["golint *.go"], "shell": true},

    // run go vet on the package
    {"cmd": ["go", "vet"]},

    // run `go install` on the package. GOBIN is set,
    // so `main` packages shouldn't result in the installation of a binary
    {"cmd": ["go", "install"]}
],

"on_save": [
    // run comp-lint when you save,
    // naturally, you can also bind this command `gs_comp_lint`
    // to a key binding if you want
    {"cmd": "gs_comp_lint"}
]

}

^^ GoSublime.sublime-settings for User

DisposaBoy commented 8 years ago

The only thing I can see is margo/gocode panicing because of invalid source code. I also checked on Linux and OS X and can't reproduce any issues.

jhurwich commented 8 years ago

I'm on OS X 10.11.3

I'm not quite understanding the sanity check error log, because I'm having trouble identifying the invalid source code you mentioned. Could you help me find it and I can remove the source to see if that fixes the issue?

While we have added HTML/CSS/JS files to our repo recently, we haven't been making too many changes on the Go side of things of late, so it's tough for me to point to any particular change in our code that would have triggered this myself.

Having neglected it previously, thanks so much, DisposaBoy, for GoSublime. It makes for the best IDE experience I've ever had, and likewise thanks for the quick response.

dmitshur commented 8 years ago

None of the GoSublime onsave functionality appears to be working for me.

Have you tried it both on small and large files?

Can you check if this is not because of #590? As a temporary workaround, try adding "ipc_timeout": 30 to your GoSublime config and see if that makes a difference.

jhurwich commented 8 years ago

Unfortunately ipc_timeout does not seem to have helped, updated UserSettings at bottom of post. (edit) And it doesn't work for either small (18 lines) or large files

Here's the console after restarting Sublime with the ipc_timeout setting and a save, none of GoSublime, gomt, goimport, etc. seem to have run:

...
SublimeLinter: XML loaded
plugin init time: 0.31875
GoSublime r16.03.22-1: init mod(gs)
GoSublime r16.03.22-1: init mod(sh)
GoSublime r16.03.22-1 sh: load env vars ['/bin/bash', '-l', '-c', 'echo "..."']: go version: ['/usr/local/go/bin/go', 'version'] -> `go version go1.5.1 darwin/amd64
` -> `go1.5.1`: 0.071s
GoSublime r16.03.22-1: init mod(mg9)

** 2016-04-06 11:50:41.371667 **:
GoSublime init r16.03.22-1 (0.001s)
|   install margo: no
|   install state: done
| sublime.version: 2221
| sublime.channel: stable
|       about.ann: a16.03.22-1
|   about.version: r16.03.22-1
|         version: r16.03.22-1
|        platform: osx-x64
|            ~bin: ~/Library/Application Support/Sublime Text 2/Packages/User/GoSublime/osx-x64/bin
|       margo.exe: ~bin/gosublime.margo_r16.03.22-1_go1.5.1.exe (ok)
|          go.exe: /usr/local/go/bin/go (ok)
|      go.version: go1.5.1
|          GOROOT: /usr/local/go
|          GOPATH: ~/Documents/Projects/gocode
|           GOBIN: (not set) (should usually be `(not set)`)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
--------------------------------

loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 0.686457
Loading dictionary Packages/Language - English/en_US.dic
using gamma: 1.9 (err: 99.6544)
startup cache, total files: 113 cache hits: 113
startup time: 0.833906 (package setup was not run)
SublimeLinter: javascript enabled (using node.js)
loaded 837 snippets
Writing file /Users/jhurwich/Documents/Projects/gocode/src/github.com/jhurwich/Conzume/cmd/conzumesim_server/simulation.go with encoding UTF-8
Package Control: No updated packages
Writing file /Users/jhurwich/Documents/Projects/gocode/src/github.com/jhurwich/Conzume/cmd/conzumesim_server/simulation.go with encoding UTF-8
Writing file /Users/jhurwich/Documents/Projects/gocode/src/github.com/jhurwich/Conzume/cmd/conzumesim_server/simulation.go with encoding UTF-8
Writing file /Users/jhurwich/Documents/Projects/gocode/src/github.com/jhurwich/Conzume/cmd/conzumesim_server/simulation.go with encoding UTF-8

And updated usersettings with ipc_timeout:

{

    // you may set specific environment variables here
    // e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
    // in values, $PATH and ${PATH} are replaced with
    // the corresponding environment(PATH) variable, if it exists.
    "env": {"GOPATH": "$HOME/Documents/Projects/gocode"},

    "fmt_cmd": ["goimports"],
    "ipc_timeout": 30,

    // enable comp-lint, this will effectively disable the live linter
    "comp_lint_enabled": true,

    // list of commands to run
    "comp_lint_commands": [
        // run `golint` on all files in the package
        // "shell":true is required in order to run the command through your shell (to expand `*.go`)
        // also see: the documentation for the `shell` setting in the default settings file ctrl+dot,ctrl+4
        {"cmd": ["golint *.go"], "shell": true},

        // run go vet on the package
        {"cmd": ["go", "vet"]},

        // run `go install` on the package. GOBIN is set,
        // so `main` packages shouldn't result in the installation of a binary
        {"cmd": ["go", "install"]}
    ],

    "on_save": [
        // run comp-lint when you save,
        // naturally, you can also bind this command `gs_comp_lint`
        // to a key binding if you want
        {"cmd": "gs_comp_lint"}
    ]
}
chnrxn commented 8 years ago

I had the same thing happen to me. Seems that the relative import change in c0c5fffc088effdde6e42b0ff585301ae4f65965 was messing things up.

I manually installed 4f3d90b9adf5c35c032d861657c55a8abf87679d in Sublime and things started working again.

I'm on Mac El Capitan, Python 2.7.11.

jhurwich commented 8 years ago

Ah, hadn't seen that support for SublimeText 2 had been dropped. I'm on SublimeText 2.

I assume that explains my issue, but I'll let someone who knows better than I confirm that my issues on SublimeText 2 are "Working As Intended" and close this issue, if that's actually the case. Thanks the heads-up chnrxn.

chnrxn commented 8 years ago

@jhurwich I think Sublime2 can technically still work, and the version that is working for me now on Sublime2 is actually the latest sans the relative import change, after the "only Sublime3 is supported" declaration. Actually I tested on Sublime3 briefly, and it didn't seem to work too.

jhurwich commented 8 years ago

:musical_score: hail to @chnrxn

Reverting c0c5fffc088effdde6e42b0ff585301ae4f65965 has enabled GoSublime's onsave functionality for me on Mac OS X 10.11.3 with Sublime-Text 2 (2.0.2, Build 2221).

Thanks chnrxn and others for helping get to the bottom of this. Back to coding!

DisposaBoy commented 8 years ago

@chnrxn

Actually I tested on Sublime3 briefly, and it didn't seem to work too.

Can you test ST3 again? I can't see how the import could break the on_save functionality without breaking everything else, in which case there should at least be an exception in the Sublime Text console.

DisposaBoy commented 8 years ago

@jhurwich Is there a reason you don't upgrade to ST3? If it's the import issue that's causing this, it can technically be fixed; but Sublime HQ does not respond to my support requests and given the fact that the default download link has changed to ST3 I take it as a sign that ST2 is not supported by them anymore either.

jhurwich commented 8 years ago

@DisposaBoy No particularly strong reason for not upgrading to ST3 other than ST2 works for me. When I was under the impression that GoSublime worked on ST3 but not ST2 I was thinking about buying ST3 to fix it. I actually had the ST3 site open when chnrxn indicated GoSublime wasn't working on either, so I decided to wait.

Frankly GoSublime jumping to ST3 would make the decision for me, though I gotta admit I'm a bit nervous about how long ST3 has been in development

DisposaBoy commented 8 years ago

@jhurwich technically you don't need to buy it. I usually use the beta version without a license (unless I want to test the latest dev version) and it works fine. It actually tends to be faster and more stable than ST2 ever was.

jhurwich commented 8 years ago

@DisposaBoy Cool, seems worth converting to ST3. I've got work stuff to power through before the weekend, and I'll plan to transition this weekend.

mikeatlas commented 8 years ago

Argh same problem here, but I'm working in a Go 1.5.x project and ST2 (on Ubuntu Linux 14.04), all the nice on-save things like auto-formatting no longer work... @jhurwich: are you at least at Go 1.6 for your toolchain?

jhurwich commented 8 years ago

My go version

go version go1.5.1 darwin/amd64

AndreasBriese commented 8 years ago

Same issue with goSublime on OSX10.8.5 go1.6.1

with ST2 and ST3

-> Reverting c0c5fff worked with both ST versions

Kugelschieber commented 8 years ago

Same here.

Go 1.6 Ubuntu 14.04 Sublime 2

mikeatlas commented 8 years ago

My comment was deleted by the repo owner, but I personally switched to Atom.io - the Go addon package tooling is just as good (maybe better, no offense to GoSublime) and Atom appears to finally be almost equivalent in all important (to me) functionality as of recently. I wouldn't have said so a year ago but it appears to be maturing rapidly and even has proper per-version package support - so in cases like these an older package wouldn't get upgraded if you don't have a compatible editor version.

DisposaBoy commented 8 years ago

@mikeatlas I deleted them because they annoyed me. You seemingly asked questions that you wanted answers to, but when I wasted my time to come on here and answered them I see that it only took you a couple hours to find the answers to all your problems.

Kugelschieber commented 8 years ago

Switching to Atom is not a real solution. In a few days I can test it on Ubuntu 16.04 :)

DisposaBoy commented 8 years ago

@DeKugelschieber No-one said it was. If you have a good reason to still be on Sublime Text 2, discuss it at https://github.com/DisposaBoy/GoSublime/issues/689

Kugelschieber commented 8 years ago

It works with sublime 3, so it's solved for me.