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

cmd/vet: go vet panics on type assertion #12114

Closed
krousey opened this issue Aug 11, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@krousey
Copy link

commented Aug 11, 2015

I don't know if this is the right place, but here goes.

My version and OS/architecture:

> go version
go version go1.4.2 linux/amd64

What I did: I ran go vet on https://github.com/GoogleCloudPlatform/kubernetes/blob/9f77e491091c88b4498e8cc90c773dff00d33330/pkg/api/validation/validation.go.

What I expected: A nicely formatted list of mistakes, a warning indicating it's not valid Go source, or no output at all.

What I saw: A panic on a failed type assertion.

 > go vet ./pkg/api/validation/validation.go 
panic: interface conversion: exact.Value is exact.unknownVal, not exact.stringVal [recovered]
    panic: interface conversion: exact.Value is exact.unknownVal, not exact.stringVal

goroutine 1 [running]:
golang.org/x/tools/go/types.(*Checker).handleBailout(0x4c20813cf70, 0x4c208239868)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/check.go:218 +0xfc
golang.org/x/tools/go/exact.BinaryOp(0x7efcd6c772a0, 0x4c20820ced0, 0xc, 0x7efcd6c77268, 0x80eb18, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/exact/exact.go:781 +0x187
golang.org/x/tools/go/types.(*Checker).binary(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c71530, 0x4c20812a960, 0x7efcd6c710b8, 0x4c20812a980, 0xc)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:781 +0x6ca
golang.org/x/tools/go/types.(*Checker).exprInternal(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6060, 0x0, 0x0, 0x4c208050b40)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1373 +0x2ea7
golang.org/x/tools/go/types.(*Checker).rawExpr(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6060, 0x0, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:908 +0x80
golang.org/x/tools/go/types.(*Checker).expr(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6060)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1427 +0x6e
golang.org/x/tools/go/types.(*Checker).binary(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6060, 0x7efcd6c71530, 0x4c20812a9a0, 0xc)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:722 +0x74
golang.org/x/tools/go/types.(*Checker).exprInternal(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6120, 0x0, 0x0, 0x4c208238b58)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1373 +0x2ea7
golang.org/x/tools/go/types.(*Checker).rawExpr(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6120, 0x0, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:908 +0x80
golang.org/x/tools/go/types.(*Checker).expr(0x4c20813cf70, 0x4c20822ea80, 0x7efcd6c715a0, 0x4c2080d6120)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1427 +0x6e
golang.org/x/tools/go/types.func·007(0x4c20822ea80, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/call.go:64 +0x7f
golang.org/x/tools/go/types.unpack(0x4c208238d20, 0x1, 0x4c2081d6600, 0x4c2081d6630, 0x522e01, 0x4c20813cf70)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/call.go:139 +0x68
golang.org/x/tools/go/types.(*Checker).call(0x4c20813cf70, 0x4c20822ea40, 0x4c2081277c0, 0x4c2081277c0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/call.go:64 +0x93b
golang.org/x/tools/go/types.(*Checker).exprInternal(0x4c20813cf70, 0x4c20822ea40, 0x7efcd6c71610, 0x4c2081277c0, 0x0, 0x0, 0x607c20)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1339 +0x2f30
golang.org/x/tools/go/types.(*Checker).rawExpr(0x4c20813cf70, 0x4c20822ea40, 0x7efcd6c71610, 0x4c2081277c0, 0x0, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:908 +0x80
golang.org/x/tools/go/types.(*Checker).expr(0x4c20813cf70, 0x4c20822ea40, 0x7efcd6c71610, 0x4c2081277c0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/expr.go:1427 +0x6e
golang.org/x/tools/go/types.(*Checker).varDecl(0x4c20813cf70, 0x4c2081eb220, 0x4c2081177a8, 0x1, 0x1, 0x0, 0x0, 0x7efcd6c71610, 0x4c2081277c0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/decl.go:158 +0x38e
golang.org/x/tools/go/types.(*Checker).objDecl(0x4c20813cf70, 0x7efcd6c71188, 0x4c2081eb220, 0x0, 0x4c208239790, 0x0, 0x8)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/decl.go:81 +0x441
golang.org/x/tools/go/types.(*Checker).packageObjects(0x4c20813cf70, 0x4c2080e5000, 0x78, 0x80)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/resolver.go:389 +0x1ff
golang.org/x/tools/go/types.(*Checker).Files(0x4c20813cf70, 0x4c20803ab20, 0x1, 0x1, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/check.go:230 +0x103
golang.org/x/tools/go/types.(*Config).Check(0x4c208154f30, 0x4c2080325e0, 0xa, 0x4c20808e040, 0x4c20803ab20, 0x1, 0x1, 0x4c2081359f0, 0x4c20803ab30, 0x0, ...)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/go/types/api.go:336 +0xbb
main.(*Package).check(0x4c2081359a0, 0x4c20808e040, 0x4c20803ab20, 0x1, 0x1, 0x0, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/cmd/vet/types.go:68 +0x2d4
main.doPackage(0x6b6830, 0x1, 0x4c20800a010, 0x1, 0x1, 0x0)
    /tmp/go-build-release/gopath/src/golang.org/x/tools/cmd/vet/main.go:335 +0x9f3
main.main()
    /tmp/go-build-release/gopath/src/golang.org/x/tools/cmd/vet/main.go:250 +0x8bb
exit status 2

@ianlancetaylor ianlancetaylor changed the title go vet panics on type assertion cmd/vet: go vet panics on type assertion Aug 11, 2015

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 11, 2015

Before the upcoming Go 1.5 release, "go vet" was not part of a release, but instead had to be installed using "go get golang.org/x/tools/cmd/vet". Try running "go get -u golang.org/x/tools/cmd/vet" to see if that fixes your problem.

@krousey

This comment has been minimized.

Copy link
Author

commented Aug 12, 2015

It does fix the problem on a system where I can update the go toolchain. Sadly I have to wait until this makes its way to my system.

@krousey krousey closed this Aug 12, 2015

@golang golang locked and limited conversation to collaborators Aug 22, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.