-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: panic: unreachable #17716
Comments
/cc @griesemer |
I suspect this is due to aliases. @kevinburke do you know by any chance if the code you're processing imports a package that exports aliases? |
It's possible, but I'd be really surprised. Here is the import list: https://godoc.org/github.com/kevinburke/twilio-go?imports I can vendor/narrow each of those to a specific commit if you'd like. |
CL https://golang.org/cl/32480 mentions this issue. |
Oh, interesting. I committed all code to a That built here: https://travis-ci.org/kevinburke/twilio-go/jobs/172343569 And produced a more readable "unreachable" error message:
That code is here: https://github.com/kevinburke/twilio-go/blob/alias/vendor/github.com/dgrijalva/jwt-go/errors.go#L45-L55 // Validation error is an error type
func (e ValidationError) Error() string {
if e.Inner != nil {
return e.Inner.Error()
} else if e.text != "" {
return e.text
} else {
return "token is invalid"
}
return e.Inner.Error()
} |
This should never be called but should help identify causes of unexpected panics such as in issue #17716. Change-Id: Id6ad0cef1088a41bfcc69110a93484a7e39c4128 Reviewed-on: https://go-review.googlesource.com/32480 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
However, I think there's a little more mystery because this commit: https://travis-ci.org/kevinburke/twilio-go/jobs/172191935 doesn't include that library and was still panicking. |
I also grepped the
|
@kevinburke Thanks, that's useful. I also just committed to tip a new version of the compiler that should print out a bit more than just "unreachable". Could you try to see what you get if you run with the latest tip (and you're original run that caused the problem). Thanks. |
Ah, here:
https://travis-ci.org/kevinburke/twilio-go/jobs/172191935#L169 |
@kevinburke Great, thanks! This should be all I need. |
CL https://golang.org/cl/32534 mentions this issue. |
Thanks - if this is a result of me doing something weird in my codebase, would love to know :) |
@kevinburke No, it's the result of me doing something weird in my codebase... I missed a couple of places where I need to handle imported aliases in go/types. The uploaded CL might fix your problem, but I've just found another place that needs the same fix. Writing some tests for this CL and that should hopefully address is. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +2d4d22a Mon Oct 31 23:53:50 2016 +0000 linux/amd64
What operating system and processor architecture are you using (
go env
)?$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/travis/gopath"
GORACE=""
GOROOT="/home/travis/.gimme/versions/go"
GOTOOLDIR="/home/travis/.gimme/versions/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build395845056=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
I ran
go vet
on my API client. A failing build can be found here: https://travis-ci.org/kevinburke/twilio-go/jobs/172067772What did you expect to see?
I expected to see no output and a 0 return code, or a list of errors in the program.
What did you see instead?
A panic followed by a stack trace:
I can reliably reproduce this error in Travis CI's build environment, but I have been unable to reproduce this problem otherwise. Running
go vet ./...
with the same library commit and Go commit SHA on darwin/amd64 runs just fine; I'm only able to reproduce the problem in Travis CI.I also tried deleting all of the other code in the library, so only the
token
directory existed. If only thetoken
directory exists,go vet
passes.To reproduce, check out the master branch on this project: https://github.com/kevinburke/twilio-go/ (specifically this commit: kevinburke/twilio-go@76f2274). Enable Travis-CI builds on your fork, then push a new commit. It should fail with the panic pasted above, after about 2 minutes. Note Travis builds tip against tip, the Go commit being built may change from under you if more commits are pushed to golang/go master.
I run a Ubuntu 16 server and tried to build Go tip on that machine to set up a reduced test case, but I'm getting an error when compiling Go tip. Someone on Gophers slack suggested it may be a memory problem; that machine has 850MB of free RAM. I can open a separate ticket for that issue if you'd like.
I tried searching for this stack trace elsewhere in Go issues and couldn't find anything, my apologies if this is a duplicate.
The text was updated successfully, but these errors were encountered: