Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, govet: panics when encountering (string constant) + string(rune constant) #4982

alberts opened this issue Mar 5, 2013 · 6 comments


Copy link

alberts commented Mar 5, 2013

What steps will reproduce the problem?

Seems to depend on a lot of packages in our internal code unfortunately.

Here's the panic for now. I can try to narrow it down somehow if this isn't enough of a

What do you see instead?

INTERNAL PANIC: interface conversion: interface is int64, not string
panic: interface conversion: interface is int64, not string [recovered]
    panic: interface conversion: interface is int64, not string

goroutine 1 [running]:
    /build/go/go/src/pkg/go/types/check.go:445 +0x175
go/types.binaryOpConst(0x563bf0, 0xc200150f30, 0x563830, 0x3039, 0xc, ...)
    /build/go/go/src/pkg/go/types/const.go:580 +0x10b9
go/types.(*checker).binary(0xc2000b43c0, 0xc2001ecdc0, 0xc2000b7e00, 0xc2000cf4a0,
0xc2000b7c40, ...)
    /build/go/go/src/pkg/go/types/expr.go:601 +0x4e2
go/types.(*checker).rawExpr(0xc2000b43c0, 0xc2001ecdc0, 0xc2000b7d80, 0xc2000c2990,
0xc20009b5d0, ...)
    /build/go/go/src/pkg/go/types/expr.go:1394 +0x2972
go/types.(*checker).expr(0xc2000b43c0, 0xc2001ecdc0, 0xc2000b7d80, 0xc2000c2990,
0xc20009b5d0, ...)
    /build/go/go/src/pkg/go/types/expr.go:1476 +0x88
go/types.(*checker).argument(0xc2000b43c0, 0xc2000ff6c0, 0x0, 0xc2000b7d80,
0xc2000c2990, ...)
    /build/go/go/src/pkg/go/types/expr.go:729 +0x10a
go/types.(*checker).rawExpr(0xc2000b43c0, 0xc2001ecdc0, 0xc2000b7c40, 0xc2000cd9c0, 0x0,
    /build/go/go/src/pkg/go/types/expr.go:1331 +0x3403
go/types.(*checker).expr(0xc2000b43c0, 0xc2001ecdc0, 0xc2000b7c40, 0xc2000cd9c0, 0x0,
    /build/go/go/src/pkg/go/types/expr.go:1476 +0x88
go/types.(*checker).assign1to1(0xc2000b43c0, 0xc2000b78c0, 0xc2000cf400, 0xc2000b7c40,
0xc2000cd9c0, ...)
    /build/go/go/src/pkg/go/types/stmt.go:103 +0x670
go/types.(*checker).assignNtoM(0xc2000b43c0, 0xc200085e00, 0x1, 0x1, 0xc200085e40, ...)
    /build/go/go/src/pkg/go/types/stmt.go:196 +0x100
go/types.(*checker).stmt(0xc2000b43c0, 0xc2000b7f40, 0xc2000cda00)
    /build/go/go/src/pkg/go/types/stmt.go:394 +0x396a
go/types.(*checker).stmtList(0xc2000b43c0, 0xc2000b8780, 0x5, 0x8)
    /build/go/go/src/pkg/go/types/stmt.go:266 +0x68
go/types.check(0xc2000d37c0, 0xc2000b76c0, 0xc200000838, 0x1, 0x1, ...)
    /build/go/go/src/pkg/go/types/check.go:483 +0x437
go/types.(*Context).Check(0xc2000d37c0, 0xc2000b76c0, 0xc200000838, 0x1, 0x1, ...)
    /build/go/go/src/pkg/go/types/api.go:98 +0x52
main.doPackage(0xc200065010, 0x1, 0x1)
    /home/alberts/go/src/cmd/vet/main.go:221 +0x955
    /home/alberts/go/src/cmd/vet/main.go:136 +0x651

Which compiler are you using (5g, 6g, 8g, gccgo)?


Which operating system are you using?


Which version are you using?  (run 'go version')

go version devel +67fc3cb0d3aa Mon Mar 04 14:54:36 2013 +1100 linux/amd64
Copy link

Comment 1:

You could improve the debugging experience by:
 * choosing a function in the trace (for example checker.stmt)
 * add a recover there:
x := recover()
switch x.(type) {
case nil:
    // nothing
case bailout:
    buf := new(bytes.Buffer)
    format.Node(buf, token.NewFileSet(), stmt /* the ast.Stmt argument */)
    printf("PANIC during checking %q: %v", x)
Anyway, the crash is easy to reproduce:
package main
import "fmt"
const A = "hello"
const B = 142
func main() {
    fmt.Println(A + string(B))

Copy link

Comment 2:

Please try CL 7474043 and check if that fixes your issue.

Labels changed: added go1.1, removed go1.1maybe.

Owner changed to @remyoudompheng.

Status changed to Started.

Copy link
Contributor Author

alberts commented Mar 5, 2013

Comment 3:

works for me

Copy link

robpike commented Mar 6, 2013

Comment 4:

Owner changed to @griesemer.

Status changed to Accepted.

Copy link

robpike commented Mar 6, 2013

Comment 5:

Labels changed: added priority-soon, removed priority-triage.

Copy link

Comment 6:

This issue was closed by revision 0b2caf2.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

6 participants