Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Better Error Message for Compiling Packages with CGO #215

Closed
@jhleath

Description

@jhleath

So, now that I have GopherJS setup and working again, I attempted to compile my program. I get the following panic log:

panic: newVariable: empty name [recovered]
    panic: newVariable: empty name

goroutine 1 [running]:
golang.org/x/tools/go/types.(*Checker).handleBailout(0xc2080a4340, 0xc20a03e350)
    /Users/hunter/Documents/Developer/golang/src/golang.org/x/tools/go/types/check.go:218 +0xfc
github.com/gopherjs/gopherjs/compiler.(*funcContext).newVariableWithLevel(0xc20987ec60, 0x0, 0x0, 0xc20a03b901, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/compiler/utils.go:209 +0x9e
github.com/gopherjs/gopherjs/compiler.Compile(0xc20aea6f21, 0x19, 0xc20a896b00, 0x9, 0x10, 0xc208bed740, 0xc208029330, 0x0, 0x885328, 0x0, ...)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/compiler/package.go:168 +0x1575
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc20801efe0, 0xc20a801db0, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:447 +0xf50
github.com/gopherjs/gopherjs/build.(*Session).ImportPackage(0xc20801efe0, 0xc20aea6f21, 0x19, 0xb, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:356 +0x5ea
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc20801efe0, 0xc20a800140, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:399 +0x208a
github.com/gopherjs/gopherjs/build.(*Session).ImportPackage(0xc20801efe0, 0xc209b66681, 0x1b, 0xb, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:356 +0x5ea
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc20801efe0, 0xc20bc6b360, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:399 +0x208a
github.com/gopherjs/gopherjs/build.(*Session).ImportPackage(0xc20801efe0, 0xc20a967dc1, 0x1e, 0x6, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:356 +0x5ea
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc20801efe0, 0xc20b08c960, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:399 +0x208a
github.com/gopherjs/gopherjs/build.(*Session).ImportPackage(0xc20801efe0, 0xc20801f101, 0x12, 0x0, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:356 +0x5ea
github.com/gopherjs/gopherjs/build.*Session.ImportPackage·fm(0xc20801f101, 0x12, 0x1d27a5, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:260 +0x4d
github.com/gopherjs/gopherjs/compiler.func·012(0xc20806f4a0, 0xc20801f101, 0x12, 0x12, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/compiler/package.go:85 +0x63
golang.org/x/tools/go/types.(*Checker).collectObjects(0xc2080a4340)
    /Users/hunter/Documents/Developer/golang/src/golang.org/x/tools/go/types/resolver.go:182 +0x29e4
golang.org/x/tools/go/types.(*Checker).Files(0xc2080a4340, 0xc20802c1c8, 0x1, 0x1, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/golang.org/x/tools/go/types/check.go:228 +0xba
golang.org/x/tools/go/types.(*Config).Check(0xc208098d80, 0x589770, 0x4, 0xc208098040, 0xc20802c1c8, 0x1, 0x1, 0xc2080aa050, 0x16d94, 0x0, ...)
    /Users/hunter/Documents/Developer/golang/src/golang.org/x/tools/go/types/api.go:340 +0xbb
github.com/gopherjs/gopherjs/compiler.Compile(0x589770, 0x4, 0xc20802c1c8, 0x1, 0x1, 0xc208098040, 0xc208029330, 0x419c00, 0xc2080291fc, 0x0, ...)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/compiler/package.go:102 +0x581
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc20801efe0, 0xc20802f810, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:447 +0xf50
github.com/gopherjs/gopherjs/build.(*Session).BuildFiles(0xc20801efe0, 0xc208029310, 0x1, 0x1, 0xc208029295, 0x9, 0xc20802f7c0, 0x42, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/build/build.go:323 +0x3d7
main.func·001(0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/tool.go:101 +0xc05
main.handleError(0xc20a03fc10, 0xc20802bfc0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/tool.go:565 +0x2f
main.func·002(0xc208096000, 0xc208029310, 0x1, 0x1)
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/tool.go:128 +0x14d
github.com/spf13/cobra.(*Command).execute(0xc208096000, 0xc2080292d0, 0x1, 0x1, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/spf13/cobra/command.go:442 +0x410
github.com/spf13/cobra.(*Command).Execute(0xc2080969a0, 0x0, 0x0)
    /Users/hunter/Documents/Developer/golang/src/github.com/spf13/cobra/command.go:507 +0x51b
main.main()
    /Users/hunter/Documents/Developer/golang/src/github.com/gopherjs/gopherjs/tool.go:448 +0x1681

I am not quite sure what is happening. The program is fairly complicated (and uses the "net" package, which I know is not supported), so I'm not sure if that could be causing it. Thanks for letting me know!

go version go1.4 darwin/amd64

Darwin Hunters-MacBook-Pro.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions