The only autocompletion I get is PANIC #164

Closed
alexaandru opened this Issue Oct 16, 2013 · 28 comments

Projects

None yet
@alexaandru

Hello,

Just installed gocode a few minutes earlier and all attempts to get it to work in vim failed. Ultimately, I started a server manually (gocode -s) and then using the gocode client in command line, I tried: "gocode autocomplete math.F" and that resulted in a:

Found 1 candidates:
  PANIC PANIC PANIC

Verifying the server window that showed:

panic: runtime error: index out of range
1(runtime.panic): /usr/local/go/src/pkg/runtime/panic.c:248
2(runtime.panicstring): /usr/local/go/src/pkg/runtime/panic.c:478
3(runtime.panicindex): /usr/local/go/src/pkg/runtime/panic.c:433
4(main.(*tok_collection).find_decl_beg): /home/alex/.go/src/github.com/nsf/gocode/ripper.go:39
5(main.(*tok_collection).find_outermost_scope): /home/alex/.go/src/github.com/nsf/gocode/ripper.go:102
6(main.(*tok_collection).rip_off_decl): /home/alex/.go/src/github.com/nsf/gocode/ripper.go:116
7(main.rip_off_decl): /home/alex/.go/src/github.com/nsf/gocode/ripper.go:133
8(main.(*auto_complete_file).process_data): /home/alex/.go/src/github.com/nsf/gocode/autocompletefile.go:55
9(main.(*auto_complete_context).apropos): /home/alex/.go/src/github.com/nsf/gocode/autocompletecontext.go:241
10(main.server_auto_complete): /home/alex/.go/src/github.com/nsf/gocode/server.go:128
11(main.(*RPC).RPC_auto_complete): /home/alex/.go/src/github.com/nsf/gocode/rpc.go:26
12(runtime.call64): /usr/local/go/src/pkg/runtime/asm_amd64.s:340
13(reflect.Value.call): /usr/local/go/src/pkg/reflect/value.go:474
14(reflect.Value.Call): /usr/local/go/src/pkg/reflect/value.go:345
15(net/rpc.(*service).call): /usr/local/go/src/pkg/net/rpc/server.go:381
16(runtime.goexit): /usr/local/go/src/pkg/runtime/proc.c:1389

I am using Go version:
go version devel +f4d1cb8d9a91 Thu Sep 19 22:34:33 2013 +1000 linux/amd64

Please let me know if there's any other info I can provide.

Thank you,
really looking forward to using this in Vim :)

@nsf
Owner
nsf commented Oct 16, 2013

"gocode autocomplete math.F" that shouldn't work. Gocode client takes different kind of arguments. In fact when I type "gocode autocomplete math.F" gocode hangs and for a good reason, it expects stdin.

Did you follow vim setup instructions? What do you mean it doesn't work? I assume you open a .go file in vim and you press C-x C-o (default omnifunc completion key) and what do you see?

@alexaandru

Please disregard, seems to be working now. Sorry for the noise and thank you very much for your quick reply :)
Previously, when I opened a .go file, I entered the same, math.F, then hit C-x C-o and expected to see Floor, but instead I actually got PANIC as an option. That's why I started poking at it in the console. Anyway, in the meantime I restarted X and now all seems fine.

@alexaandru alexaandru closed this Oct 16, 2013
@nsf
Owner
nsf commented Oct 16, 2013

If it works - great. :)

@samuell
samuell commented Sep 8, 2014

Having the same problem, using gocode from ubuntu repos:
selection_538

@nsf
Owner
nsf commented Sep 8, 2014

If the gocode version and go compiler version mismatch, it's possible. You need to make them up to date. I don't recommend installing gocode and go from distribution repositories, because it's easy to do manually.

@samuell
samuell commented Sep 8, 2014

@nsf Yeah, I guess you have a point there. I think they are different versions indeed. Will check.

@samuell
samuell commented Sep 8, 2014

Turned out I was fighting in vain for very long ...
I had to delete the /tmp/gocode-daemon.samuel socket first, which was revealed when trying to start a new gocode server with gocode -s. So, just for reference:

[samuel test]$ gocode -s
2014/09/08 14:18:06 unix socket: '/tmp/gocode-daemon.samuel' already exists
[samuel test]$ rm /tmp/gocode-daemon.samuel
[samuel test]$ gocode -s

(Then of course, adopt to whatever the name is in "unix socket [file name] already exists")

@nsf
Owner
nsf commented Sep 8, 2014

I think latest versions of the gocode delete the socket file automatically if they fail to connect.

@kjda
kjda commented Mar 14, 2015

same problem here. Go1.4 installed using gvm

panic: unexpected token: "?"
1(runtime.panic): /usr/lib/go/src/pkg/runtime/panic.c:248
2(main.(*gc_parser).error): /build/buildd/gocode-0~git20130712/package.go:260
3(main.(*gc_parser).errorf): /build/buildd/gocode-0~git20130712/package.go:264
4(main.(*gc_parser).parse_type): /build/buildd/gocode-0~git20130712/package.go:638
5(main.(*gc_parser).parse_field): /build/buildd/gocode-0~git20130712/package.go:382
6(main.func·016): /build/buildd/gocode-0~git20130712/package.go:528
7(main.(*gc_parser).parse_struct_type): /build/buildd/gocode-0~git20130712/package.go:538
8(main.(*gc_parser).parse_type): /build/buildd/gocode-0~git20130712/package.go:608
9(main.(*gc_parser).parse_type_decl): /build/buildd/gocode-0~git20130712/package.go:718
10(main.(*gc_parser).parse_decl): /build/buildd/gocode-0~git20130712/package.go:827
11(main.(*gc_parser).parse_export): /build/buildd/gocode-0~git20130712/package.go:854
12(main.(*package_file_cache).process_package_data): /build/buildd/gocode-0~git20130712/package.go:133
13(main.(*package_file_cache).update_cache): /build/buildd/gocode-0~git20130712/package.go:91
14(main.func·002): /build/buildd/gocode-0~git20130712/autocompletecontext.go:325
15(runtime.goexit): /usr/lib/go/src/pkg/runtime/proc.c:1394

panic: One of the package cache updaters panicked
1(runtime.panic): /usr/lib/go/src/pkg/runtime/panic.c:248
2(main.update_packages): /build/buildd/gocode-0~git20130712/autocompletecontext.go:333
3(main.(*auto_complete_context).update_caches): /build/buildd/gocode-0~git20130712/autocompletecontext.go:165
4(main.(*auto_complete_context).apropos): /build/buildd/gocode-0~git20130712/autocompletecontext.go:246
5(main.server_auto_complete): /build/buildd/gocode-0~git20130712/server.go:122
6(main.(*RPC).RPC_auto_complete): /build/buildd/gocode-0~git20130712/rpc.go:25
7(runtime.call64): /usr/lib/go/src/pkg/runtime/asm_amd64.s:340
8(reflect.Value.call): /usr/lib/go/src/pkg/reflect/value.go:474
9(reflect.Value.Call): /usr/lib/go/src/pkg/reflect/value.go:345
10(net/rpc.(*service).call): /usr/lib/go/src/pkg/net/rpc/server.go:381
11(runtime.goexit): /usr/lib/go/src/pkg/runtime/proc.c:1394
@nsf
Owner
nsf commented Mar 14, 2015

@kjda Nah, yours is not the same as this one. Yours is more like this: #225

@nsf
Owner
nsf commented Mar 14, 2015

@kjda See this issue in general: that's the original one: #163

@kjda
kjda commented Mar 14, 2015

@nsf it doesn't work regardless of the imported package.. fmt., log., myownpkg. , etc.. I always get PANIC.. however, it does autocomplete variables or functions defined in the same file. `go get -u github.com/nsf/gocode``does not help

@nsf
Owner
nsf commented Mar 14, 2015

It's possible that there are multiple gocode binaries for whatever reason. What which -a gocode says?

@kjda
kjda commented Mar 14, 2015

´´´
/usr/bin/gocode
/var/www/go/bin/gocode
´´´
removing either of them did not help( mv /usr/bin/gocode /usr/bin/gocode-backup).. not sure if this is the right way to do it

I also noticed that just by opening a .go file the status bar shows ´´´vim-go: PANIC PANIC PANIC´´´

@nsf
Owner
nsf commented Mar 14, 2015

Oh, I forgot to tell you to actually restart gocode. Because if you updated it, it won't work as is, since there is an actual process running already. Do: gocode close. It will kill the server and will start a new one automatically. Or just reboot if you wish.

@kjda
kjda commented Mar 14, 2015

Super! Thanks man! +++

@akarki15

had the same problem. this fixed it!! thanks a lot!
🙌 🙌 🙌 🙌 🙌 🙌 🙌 🙌

@integrii
integrii commented Aug 6, 2016

I was getting this in atom with go-autocomplete, but simply running gocode close fixed the issue!

@sksea
sksea commented Aug 18, 2016

gocode close didn't work for me. Had to remove gocode listed at which -a gocode and reinstall it via go get -u.

@gopherliu

@samuell , in vim-go , go1.7 , have the same problem

@jphenow
jphenow commented Aug 22, 2016

@gopherliu did you try go close since the update? That ended up working for me after updating gocode and vim-go

@akarki15
akarki15 commented Aug 22, 2016 edited

have you tried turning it off and turning it back again?
http://giphy.com/gifs/the-it-crowd-chris-odowd-F7yLXA5fJ5sLC

@nsf
Owner
nsf commented Aug 22, 2016

Yeah, I kind of regret not embedding the version info into gocode binaries and checking those on each client/server communication. Could solve some of your user experience issues.

@4ydx
4ydx commented Aug 24, 2016 edited

Had the same issue. Just killing the process wasn't good enough rather I had to delete the socket file as well. Just do what samuell suggested above.

@mewben
mewben commented Sep 1, 2016

Thanks. Updating gocode works for me.

@cyberswat

Here's the one liner to update gocode

gocode close && go get -u github.com/nsf/gocode

@AlexeiSuleac

gocode close helped me as well here...

@frank0718

atom got this problem ; gocode close && go get -u github.com/nsf/gocode ; reopen atom; works like a charm

@jyutzler jyutzler referenced this issue in joefitzgerald/autocomplete-go Oct 21, 2016
Closed

shows PANIC as the only option #51

1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment