google / grumpy

Grumpy is a Python to Go source code transcompiler and runtime.
Apache License 2.0
10.56k stars 652 forks source link

Go 1.9: exporter: variable/function exported but not defined: _ #378

Closed erpalma closed 6 years ago

erpalma commented 6 years ago

Hello, I've got this error when trying the hello world test. Go 1.9 on Gentoo, tomorrow I'll try with 1.8.


<autogenerated>:1:0: cannot use _ as value
<autogenerated>:1:0: internal compiler error: exporter: variable/function exported but not defined: _

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /usr/lib/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xb701bc, 0x38, 0xc423833490, 0x1, 0x1)
        /usr/lib/go/src/cmd/compile/internal/gc/subr.go:181 +0x230
cmd/compile/internal/gc.(*exporter).obj(0xc423833628, 0xc420065860)
        /usr/lib/go/src/cmd/compile/internal/gc/bexport.go:491 +0x70d
cmd/compile/internal/gc.export(0xc42516dd40, 0x0, 0x0)
        /usr/lib/go/src/cmd/compile/internal/gc/bexport.go:347 +0x723
cmd/compile/internal/gc.dumpexport()
        /usr/lib/go/src/cmd/compile/internal/gc/export.go:253 +0x8a
cmd/compile/internal/gc.dumpobj1(0x7ffe2d6a05fa, 0x1e, 0x3)
        /usr/lib/go/src/cmd/compile/internal/gc/obj.go:95 +0xa5d
cmd/compile/internal/gc.dumpobj()
        /usr/lib/go/src/cmd/compile/internal/gc/obj.go:51 +0x61
cmd/compile/internal/gc.Main(0xb73f90)
        /usr/lib/go/src/cmd/compile/internal/gc/main.go:631 +0x2652
main.main()
        /usr/lib/go/src/cmd/compile/main.go:49 +0x95

make: *** [Makefile:216: build/pkg/linux_amd64/grumpy.a] Error 1```
erpalma commented 6 years ago

Just tested with 1.8.3, no problems!

escholtz commented 6 years ago

This issue appears to be caused by the const _ = declarations. Replacing the underscores with a dummy name allows the compiler to succeed. However, probably need verification from library authors that the previous behavior is still preserved. https://github.com/google/grumpy/pull/381