Skip to content

go vet panic #16775

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

Closed
ghaering opened this issue Aug 17, 2016 · 2 comments
Closed

go vet panic #16775

ghaering opened this issue Aug 17, 2016 · 2 comments

Comments

@ghaering
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go version go1.7 linux/amd64

  1. What operating system and processor architecture are you using (go env)?

Arch Linux packaged go:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/gerhard/"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build137499190=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do?

I will attach the files to reproduce the panic in an attachment. They include a third-party package "github.com/stretchr/testify/assert".

  1. What did you expect to see?

go tool vet not panicking.

  1. What did you see instead?

    $ go tool vet -all ./xx/util_test.go ./xx/util.go
    panic: inconsistent import:
    var time.UTC *time.Location
    previously imported as:
    var UTC *time.Location
    [recovered]
    panic: inconsistent import:
    var time.UTC *time.Location
    previously imported as:
    var UTC *time.Location

    goroutine 1 [running]:
    panic(0x674b20, 0xc4201bf600)
    /usr/lib/go/src/runtime/panic.go:500 +0x1a1
    go/types.(_Checker).handleBailout(0xc4200ba1c0, 0xc4200cd8e8)
    /usr/lib/go/src/go/types/check.go:213 +0xae
    panic(0x674b20, 0xc4201bf600)
    /usr/lib/go/src/runtime/panic.go:458 +0x243
    go/internal/gcimporter.(_importer).declare(0xc4201c2b60, 0x7f64a0, 0xc42025c5f0)
    /usr/lib/go/src/go/internal/gcimporter/bimport.go:175 +0x17c
    go/internal/gcimporter.(_importer).obj(0xc4201c2b60, 0xfffffffffffffffc)
    /usr/lib/go/src/go/internal/gcimporter/bimport.go:195 +0x1b4
    go/internal/gcimporter.BImportData(0xc420013020, 0xc420206000, 0x39d3a, 0x3fe00, 0xc42000fa51, 0x4, 0x0, 0x4, 0x10, 0x10)
    /usr/lib/go/src/go/internal/gcimporter/bimport.go:88 +0x390
    go/internal/gcimporter.Import(0xc420013020, 0xc42000fa51, 0x4, 0x7ffe150147af, 0x4, 0xc420159db0, 0x0, 0x0)
    /usr/lib/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
    go/importer.gcimports.ImportFrom(0xc420013020, 0xc42000fa51, 0x4, 0x7ffe150147af, 0x4, 0x0, 0x1, 0x2, 0x0)
    /usr/lib/go/src/go/importer/importer.go:70 +0x67
    go/types.(_Checker).collectObjects(0xc4200ba1c0)
    /usr/lib/go/src/go/types/resolver.go:191 +0x826
    go/types.(_Checker).checkFiles(0xc4200ba1c0, 0xc42000fa80, 0x2, 0x2, 0x0, 0x0)
    /usr/lib/go/src/go/types/check.go:225 +0xaa
    go/types.(_Checker).Files(0xc4200ba1c0, 0xc42000fa80, 0x2, 0x2, 0xc420156c90, 0xc4200cd960)
    /usr/lib/go/src/go/types/check.go:218 +0x49
    go/types.(_Config).Check(0xc42000b340, 0xc42000f990, 0x4, 0xc42000b200, 0xc42000fa80, 0x2, 0x2, 0xc420159680, 0x10, 0xc4200001a0, ...)
    /usr/lib/go/src/go/types/api.go:344 +0x1a3
    main.(_Package).check(0xc4200168a0, 0xc42000b200, 0xc42000fa80, 0x2, 0x2, 0xc42000fa90, 0x1)
    /usr/lib/go/src/cmd/vet/types.go:76 +0x370
    main.doPackage(0x6cf324, 0x1, 0xc42000a220, 0x2, 0x2, 0x0, 0x1)
    /usr/lib/go/src/cmd/vet/main.go:336 +0x999
    main.main()
    /usr/lib/go/src/cmd/vet/main.go:244 +0x345

@ghaering
Copy link
Author

Trigger the bug with:

go tool vet -all util_test.go util.go

testcase.zip

@ghaering
Copy link
Author

Nevermind. Apparently you cannot simply use the "go installl"-ed stuff from older go releases. I nuked $GOPATH/pkg and run the commands again and the "bug" is no more. There was no bug in go vet. Sorry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants