gocode icon indicating copy to clipboard operation
gocode copied to clipboard

Panics with unknown export format version -1

Open AudriusButkevicius opened this issue 6 years ago • 16 comments

panic: unknown export format version -1 ("i\x00\xe9\x03\xc6\x06\x18$GOROOT\\src\\fmt\\print.go\x00\x05Write\x01b\x01n\x03err\x05Width\x03wid\x02ok\tPrecision\x04prec\x04Flag\x01c\x06Format\x01f\x05State\x06String\bGoString\x01w\x06Writer\x02io\x06format\x01a\aesc:0x1\aesc:0x9\x17$GOROOT\\src\\fmt\\scan.go\bReadRune\x01r\x04size")
1(runtime.call32): C:/Go191/src/runtime/asm_amd64.s:509
2(runtime.gopanic): C:/Go191/src/runtime/panic.go:491
3(main.(*gc_bin_parser).parse_export): C:/Go/bin/src/github.com/nsf/gocode/package_bin.go:126
4(main.(*package_file_cache).process_package_data): C:/Go/bin/src/github.com/nsf/gocode/package.go:132
5(main.(*package_file_cache).update_cache): C:/Go/bin/src/github.com/nsf/gocode/package.go:92
6(main.update_packages.func1): C:/Go/bin/src/github.com/nsf/gocode/autocompletecontext.go:455
7(runtime.goexit): C:/Go191/src/runtime/asm_amd64.s:2337

Not sure what needs clearing/removing.

AudriusButkevicius avatar Jun 10 '18 13:06 AudriusButkevicius

I'm getting this as well after switching to Go 1.11beta1. Switching back to Go 1.10 seems like has no effect. Maybe it's a coincidence, I don't know. I'm on latest MacOS X.

Also, I was using GOOS=js GOARCH=wasm for the build when I start getting those crashes, if it's related.

Any suggestions on how to debug this issue?

divan avatar Jun 28 '18 15:06 divan

Another detail, that may be relevant: my Go 1.11 installation is a binary installation (I didn;t compile it myself).

Package files seems to have totally different encoding that crashes gocode. I can't find docs or commits that explain the diff, though.

Here is an output of pkg files for fmt for Go 1.10 and Go 1.11.

head -c 300 /usr/local/go1.10/pkg/darwin_amd64/fmt.a | less | pbcopy

!<arch>
__.PKGDEF       0           0     0     644     1384      `
go object darwin amd64 go1.10 X:framepointer
build id "KHuqXkHLVgkW_Ou5euoy/tdMow2Eq6Ax6uwLF86Xb"
----

build id "KHuqXkHLVgkW_Ou5euoy/tdMow2Eq6Ax6uwLF86Xb"

$$B
version 5

 fmt 
L
|SGOROOTsrcprint.go	State  	Write"b 

head -c 300 /usr/local/go1.11beta1/pkg/darwin_amd64/fmt.a | less | pbcopy

!<arch>
__.PKGDEF       0           0     0     644     1568      `
go object darwin amd64 go1.11beta1 X:framepointer
build id "NzYrUFEPyrRrj_uyqpl5/n8zsFBLs-yT__ncV8geh"
----


$$B
i È∆$GOROOT/src/fmt/print.go WritebnerrWidthwidok	PrecisionprecFlagcFormatfStateStringGoStringwWri

There is no version info and that's causing a crash.

divan avatar Jun 28 '18 16:06 divan

Okay, I found it, it's called indexed export format and has been introduced recently: https://groups.google.com/forum/#!msg/golang-codereviews/6vqMfk1krNU/lzoJtkbuCQAJ

Some more info: https://groups.google.com/forum/#!topic/golang-dev/Lj_B-O6OMv8

divan avatar Jun 28 '18 16:06 divan

Yeah I ran my own go 1.10+dev when I started seeing this.

AudriusButkevicius avatar Jun 28 '18 17:06 AudriusButkevicius

So the proper solution would be to implement a parser for the indexed export format. I started to work on this, but it might take longer than by people who already worked with it. It actually requires a lot of copying and adapting from internal packages of Go codebase.

divan avatar Jun 28 '18 17:06 divan

Is it correct that until gcode understands the new format, it is broken for Go >= 1.11?

fd0 avatar Jul 21 '18 11:07 fd0

I've opened an issue over at https://github.com/mdempsky/gocode/issues/43

fd0 avatar Jul 21 '18 12:07 fd0

Hm, turns out my test case was wrong, it works for me with Go 1.11beta2 and mdempksy's fork at https://github.com/mdempsky/gocode

fd0 avatar Jul 21 '18 15:07 fd0

I do not understand why this issue is closed... I am keep getting panic with go 1.11

lukatendai avatar Aug 27 '18 13:08 lukatendai

It's not closed

AudriusButkevicius avatar Aug 27 '18 14:08 AudriusButkevicius

oh, yes... sorry

lukatendai avatar Aug 27 '18 14:08 lukatendai

Same issue here, even with go-langserver. Not working with go 1.11.

seagle0128 avatar Aug 29 '18 15:08 seagle0128

I'm having the same issue after upgrading to go 1.11

Xammie avatar Aug 29 '18 21:08 Xammie

Hi! Is there a workaround for this issue. I am seeing the same with go version go1.11 darwin/amd64

rarchana2001asu avatar Aug 30 '18 23:08 rarchana2001asu

Gocode is no longer maintained, you can try a fork, such as: https://github.com/mdempsky/gocode

nsf avatar Aug 31 '18 05:08 nsf

The fork at https://github.com/mdempsky/gocode fixes this issue.

cnbuff410 avatar Aug 31 '18 21:08 cnbuff410