Please answer these questions before submitting your issue. Thanks!
go version)?go version devel +d4ed8da Wed May 18 08:19:51 2016 +0000 linux/amd64
go env)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/marko/goprojects"
GORACE=""
GOROOT="/home/marko/go"
GOTOOLDIR="/home/marko/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build502106107=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
I did go vet ./... to check my program.
Error or lack of error, but not panic.
$ go vet ./...
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(0x6428e0, 0xc4202d0d10)
/home/marko/go/src/runtime/panic.go:500 +0x18c
go/types.(*Checker).handleBailout(0xc4200ba1c0, 0xc4200cb918)
/home/marko/go/src/go/types/check.go:213 +0x95
panic(0x6428e0, 0xc4202d0d10)
/home/marko/go/src/runtime/panic.go:458 +0x226
go/internal/gcimporter.(*importer).declare(0xc420096480, 0x7b71a0, 0xc4202e1c20)
/home/marko/go/src/go/internal/gcimporter/bimport.go:173 +0x164
go/internal/gcimporter.(*importer).obj(0xc420096480, 0xfffffffffffffffc)
/home/marko/go/src/go/internal/gcimporter/bimport.go:193 +0x191
go/internal/gcimporter.BImportData(0xc42000f080, 0xc420290000, 0x38ea0, 0x3fe00, 0xc42001395b, 0x4, 0x0, 0x4, 0x6bd3ac, 0xc41fff05ab)
/home/marko/go/src/go/internal/gcimporter/bimport.go:86 +0x31e
go/internal/gcimporter.Import(0xc42000f080, 0xc42001395b, 0x4, 0x7ffd7a154e66, 0x14, 0xc42016d680, 0x0, 0x0)
/home/marko/go/src/go/internal/gcimporter/gcimporter.go:166 +0x521
go/importer.gcimports.ImportFrom(0xc42000f080, 0xc42001395b, 0x4, 0x7ffd7a154e66, 0x14, 0x0, 0x4, 0x8, 0x0)
/home/marko/go/src/go/importer/importer.go:70 +0x5a
go/types.(*Checker).collectObjects(0xc4200ba1c0)
/home/marko/go/src/go/types/resolver.go:191 +0x7c8
go/types.(*Checker).checkFiles(0xc4200ba1c0, 0xc4200382d8, 0x1, 0x1, 0x0, 0x0)
/home/marko/go/src/go/types/check.go:225 +0xa0
go/types.(*Checker).Files(0xc4200ba1c0, 0xc4200382d8, 0x1, 0x1, 0xc420174de0, 0x18)
/home/marko/go/src/go/types/check.go:218 +0x3f
go/types.(*Config).Check(0xc420176940, 0xc4200138e8, 0x4, 0xc4200114c0, 0xc4200382d8, 0x1, 0x1, 0xc42016ceb0, 0x18, 0xc420173f80, ...)
/home/marko/go/src/go/types/api.go:344 +0x184
main.(*Package).check(0xc4200188a0, 0xc4200114c0, 0xc4200382d8, 0x1, 0x1, 0xc4200382e0, 0x0)
/home/marko/go/src/cmd/vet/types.go:76 +0x330
main.doPackage(0x69a65c, 0x1, 0xc42000a370, 0x1, 0x1, 0x0)
/home/marko/go/src/cmd/vet/main.go:333 +0x956
main.main()
/home/marko/go/src/cmd/vet/main.go:241 +0x317
exit status 2
Can you give us instructions for how to reproduce the problem?
CC @griesemer for a go/importer crash.
Unfortunately no. Program that I am go vet-ing is too big and I don't even know where to start reducing it. There are no clues in this backtrace. Any pointers?
Furthermore, I can't reproduce it any more. I have turned off go vet execution to be able to work on a program and now, when I have turned it back on, it does not panic.
Possibly it is somehow connected to update of a go lang.
I had some other go-tip version installed before today. Today i went to ~/go, did
$ git pull
$ cd src/
$ ./all.bash
$ cd ~/goprojects/...
$ make
and saw that go vet crashes. Then I commented go vet execution in Makefile and continued my day.
Now, after you asked me for a reproduce case, I have tried go vet and it works.
Anyway, I am saying that possibly after upgrading go lang and without recompiling everything (I didn't delete $GOPATH/pkg, go vet crashes. But after recompiling everything, go vet is fine.
Thanks for the update. Closing until the problem can be reproduced.
This is probably a duplicate of #15491 which was fixed a while back.
I just started facing this issue, after upgrading to Go 1.7beta1:
% go version
go version go1.6.2 darwin/amd64
% go vet ./...
% go version
go version go1.7beta1 darwin/amd64
% go vet ./...
panic: inconsistent import:
var crypto/rand.Reader io.Reader
previously imported as:
var Reader io.Reader
[recovered]
panic: inconsistent import:
var crypto/rand.Reader io.Reader
previously imported as:
var Reader io.Reader
goroutine 1 [running]:
panic(0x25f720, 0xc4203fc1f0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
go/types.(*Checker).handleBailout(0xc4200b61c0, 0xc4200c78e8)
/usr/local/go/src/go/types/check.go:213 +0xae
panic(0x25f720, 0xc4203fc1f0)
/usr/local/go/src/runtime/panic.go:458 +0x243
go/internal/gcimporter.(*importer).declare(0xc42008e000, 0x3d81c0, 0xc4203ea5f0)
/usr/local/go/src/go/internal/gcimporter/bimport.go:173 +0x17c
go/internal/gcimporter.(*importer).obj(0xc42008e000, 0xfffffffffffffffc)
/usr/local/go/src/go/internal/gcimporter/bimport.go:193 +0x1af
go/internal/gcimporter.BImportData(0xc42000af00, 0xc420334000, 0x703e, 0x7e00, 0xc420166a51, 0xb, 0x0, 0xb, 0xc4203f4ff0, 0xc4200c70c8)
/usr/local/go/src/go/internal/gcimporter/bimport.go:86 +0x34c
go/internal/gcimporter.Import(0xc42000af00, 0xc420166a51, 0xb, 0x7fff5fbff610, 0x8, 0xc420320190, 0x0, 0x0)
/usr/local/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
go/importer.gcimports.ImportFrom(0xc42000af00, 0xc420166a51, 0xb, 0x7fff5fbff610, 0x8, 0x0, 0xc4202d55e0, 0x0, 0x0)
/usr/local/go/src/go/importer/importer.go:70 +0x67
go/types.(*Checker).collectObjects(0xc4200b61c0)
/usr/local/go/src/go/types/resolver.go:191 +0x81d
go/types.(*Checker).checkFiles(0xc4200b61c0, 0xc42018b600, 0x2, 0x2, 0x0, 0x0)
/usr/local/go/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4200b61c0, 0xc42018b600, 0x2, 0x2, 0xc420192a80, 0xc4200cb960)
/usr/local/go/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc42018d9c0, 0xc420015817, 0x5, 0xc420013f00, 0xc42018b600, 0x2, 0x2, 0xc420187400, 0x45e000, 0x0, ...)
/usr/local/go/src/go/types/api.go:344 +0x19f
main.(*Package).check(0xc42001a8a0, 0xc420013f00, 0xc42018b600, 0x2, 0x2, 0xc42018b610, 0x1)
/usr/local/go/src/cmd/vet/types.go:76 +0x36c
main.doPackage(0x2b769c, 0x1, 0xc42000a220, 0x2, 0x2, 0x0)
/usr/local/go/src/cmd/vet/main.go:333 +0x992
main.main()
/usr/local/go/src/cmd/vet/main.go:241 +0x335
exit status 2
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(0x25f720, 0xc420141b10)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
go/types.(*Checker).handleBailout(0xc4200ce1c0, 0xc42004b8d8)
/usr/local/go/src/go/types/check.go:213 +0xae
panic(0x25f720, 0xc420141b10)
/usr/local/go/src/runtime/panic.go:458 +0x243
go/internal/gcimporter.(*importer).declare(0xc4200a2cc0, 0x3d81c0, 0xc4205f6d70)
/usr/local/go/src/go/internal/gcimporter/bimport.go:173 +0x17c
go/internal/gcimporter.(*importer).obj(0xc4200a2cc0, 0xfffffffffffffffc)
/usr/local/go/src/go/internal/gcimporter/bimport.go:193 +0x1af
go/internal/gcimporter.BImportData(0xc42007ae40, 0xc42035a000, 0x3a210, 0x3fe00, 0xc42007995b, 0x4, 0x0, 0x4, 0xc4201392f0, 0xc42004b0b8)
/usr/local/go/src/go/internal/gcimporter/bimport.go:86 +0x34c
go/internal/gcimporter.Import(0xc42007ae40, 0xc42007995b, 0x4, 0x7fff5fbff598, 0x7, 0xc4205b7040, 0x0, 0x0)
/usr/local/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
go/importer.gcimports.ImportFrom(0xc42007ae40, 0xc42007995b, 0x4, 0x7fff5fbff598, 0x7, 0x0, 0xc42017ec80, 0x0, 0x0)
/usr/local/go/src/go/importer/importer.go:70 +0x67
go/types.(*Checker).collectObjects(0xc4200ce1c0)
/usr/local/go/src/go/types/resolver.go:191 +0x81d
go/types.(*Checker).checkFiles(0xc4200ce1c0, 0xc42018b600, 0x8, 0x8, 0x0, 0x0)
/usr/local/go/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4200ce1c0, 0xc42018b600, 0x8, 0x8, 0xc420199800, 0xc4200e3960)
/usr/local/go/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc420193cc0, 0xc420079667, 0x7, 0xc420095c00, 0xc42018b600, 0x8, 0x8, 0xc420194b40, 0x45e4b0, 0x0, ...)
/usr/local/go/src/go/types/api.go:344 +0x19f
main.(*Package).check(0xc420076a80, 0xc420095c00, 0xc42018b600, 0x8, 0x8, 0x0, 0xc4200b9980)
/usr/local/go/src/cmd/vet/types.go:76 +0x36c
main.doPackage(0x2b769c, 0x1, 0xc420098010, 0x8, 0x8, 0x0)
/usr/local/go/src/cmd/vet/main.go:333 +0x992
main.main()
/usr/local/go/src/cmd/vet/main.go:241 +0x335
exit status 2
panic: inconsistent import:
func errors.New(text string) error
previously imported as:
func errors.New(text string) error
[recovered]
panic: inconsistent import:
func errors.New(text string) error
previously imported as:
func errors.New(text string) error
goroutine 1 [running]:
panic(0x25f720, 0xc4203f73c0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
go/types.(*Checker).handleBailout(0xc4200b61c0, 0xc4200c98e8)
/usr/local/go/src/go/types/check.go:213 +0xae
panic(0x25f720, 0xc4203f73c0)
/usr/local/go/src/runtime/panic.go:458 +0x243
go/internal/gcimporter.(*importer).declare(0xc4204b60c0, 0x3d7ea0, 0xc4203fe460)
/usr/local/go/src/go/internal/gcimporter/bimport.go:173 +0x17c
go/internal/gcimporter.(*importer).obj(0xc4204b60c0, 0xfffffffffffffffb)
/usr/local/go/src/go/internal/gcimporter/bimport.go:201 +0x49d
go/internal/gcimporter.BImportData(0xc420014ea0, 0xc420406000, 0xb62, 0xe00, 0xc420169771, 0x6, 0x0, 0x6, 0x10, 0x10)
/usr/local/go/src/go/internal/gcimporter/bimport.go:86 +0x34c
go/internal/gcimporter.Import(0xc420014ea0, 0xc420169771, 0x6, 0x7fff5fbff5f0, 0x5, 0xc420430f00, 0x0, 0x0)
/usr/local/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
go/importer.gcimports.ImportFrom(0xc420014ea0, 0xc420169771, 0x6, 0x7fff5fbff5f0, 0x5, 0x0, 0x1, 0x2, 0x0)
/usr/local/go/src/go/importer/importer.go:70 +0x67
go/types.(*Checker).collectObjects(0xc4200b61c0)
/usr/local/go/src/go/types/resolver.go:191 +0x81d
go/types.(*Checker).checkFiles(0xc4200b61c0, 0xc42017df00, 0x4, 0x4, 0x0, 0x0)
/usr/local/go/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4200b61c0, 0xc42017df00, 0x4, 0x4, 0xc420192360, 0xc4200c9960)
/usr/local/go/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc42018b700, 0xc420017837, 0x5, 0xc420013e80, 0xc42017df00, 0x4, 0x4, 0xc42017fdb0, 0x45e000, 0x0, ...)
/usr/local/go/src/go/types/api.go:344 +0x19f
main.(*Package).check(0xc42001a960, 0xc420013e80, 0xc42017df00, 0x4, 0x4, 0x0, 0xc420011880)
/usr/local/go/src/cmd/vet/types.go:76 +0x36c
main.doPackage(0x2b769c, 0x1, 0xc42000a1a0, 0x4, 0x4, 0x0)
/usr/local/go/src/cmd/vet/main.go:333 +0x992
main.main()
/usr/local/go/src/cmd/vet/main.go:241 +0x335
exit status 2
Should I open a new issue?
@fsouza I cannot reproduce this. Please verify that you have compiled everything using the latest 1.7 version (including any libraries under GOPATH). If you still see the problem, please open a new issue with detailed instructions how to reproduce and assign it directly to me (@gri). Thanks.
@griesemer nevermind, after cleaning my GOPATH the issue is gone. Thank you!
I also saw this after an upgrade to Go 1.7. It would be nice if the output mentioned the possibility of incompatible files in $GOPATH/pkg.
@aaronlehmann Did you have libraries installed that you compiled with some non-release version; i.e., a version built off tip, rather than an official release? If so, those libraries may have been compiled with a buggy compiler. We don't really make guarantees for compilers that are not from official releases. If not, I'd love to see a reproducible case. Thanks.
I did have a release candidate of Go 1.6 installed at one point, so it's theoretically possible I had some libraries built with that version. Unfortunately I've since deleted pkg so I won't be able to provide a reproducible case.
I have reproduced this off of a fresh upgrade from 1.6.2 to 1.7. I do not believe that I have ever had an RC installed; go was previously installed with homebrew, and was installed this time with the official installer.
I did mv pkg pkg.bak and then go vet works (with a new pkg generated).
I removed the new pkg and added back the old one, and it fails again.
I'm retaining a copy of the old pkg directory, if you'd like me to try some more probing, but for now the workaround of deleting pkg seems to work.
My error log is this:
馃惓 vet
panic: inconsistent import:
func github.com/docker/swarmkit/vendor/golang.org/x/net/context.WithValue(parent github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context, key interface{}, val interface{}) github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context
previously imported as:
func github.com/docker/swarmkit/vendor/golang.org/x/net/context.WithValue(parent github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context, key interface{}, val interface{}) github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context
[recovered]
panic: inconsistent import:
func github.com/docker/swarmkit/vendor/golang.org/x/net/context.WithValue(parent github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context, key interface{}, val interface{}) github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context
previously imported as:
func github.com/docker/swarmkit/vendor/golang.org/x/net/context.WithValue(parent github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context, key interface{}, val interface{}) github.com/docker/swarmkit/vendor/golang.org/x/net/context.Context
goroutine 1 [running]:
panic(0x2734c0, 0xc4205a59d0)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
go/types.(*Checker).handleBailout(0xc4200ba1c0, 0xc420cfd8d8)
/usr/local/go/src/go/types/check.go:213 +0xae
panic(0x2734c0, 0xc4205a59d0)
/usr/local/go/src/runtime/panic.go:458 +0x243
go/internal/gcimporter.(*importer).declare(0xc4201c7110, 0x3f4180, 0xc420c536d0)
/usr/local/go/src/go/internal/gcimporter/bimport.go:175 +0x17c
go/internal/gcimporter.(*importer).obj(0xc4201c7110, 0xfffffffffffffffb)
/usr/local/go/src/go/internal/gcimporter/bimport.go:203 +0x4a2
go/internal/gcimporter.BImportData(0xc420014f60, 0xc420512000, 0xf3a7, 0xfe00, 0xc420cdc184, 0x3a, 0x0, 0x3a, 0x0, 0x287c20)
/usr/local/go/src/go/internal/gcimporter/bimport.go:88 +0x390
go/internal/gcimporter.Import(0xc420014f60, 0xc42015a821, 0x18, 0x7fff5fbff8d0, 0x2, 0xc4204808c0, 0x0, 0x0)
/usr/local/go/src/go/internal/gcimporter/gcimporter.go:166 +0x551
go/importer.gcimports.ImportFrom(0xc420014f60, 0xc42015a821, 0x18, 0x7fff5fbff8d0, 0x2, 0x0, 0xc420c25810, 0x0, 0x0)
/usr/local/go/src/go/importer/importer.go:70 +0x67
go/types.(*Checker).collectObjects(0xc4200ba1c0)
/usr/local/go/src/go/types/resolver.go:191 +0x826
go/types.(*Checker).checkFiles(0xc4200ba1c0, 0xc420208e40, 0x4, 0x4, 0x0, 0x0)
/usr/local/go/src/go/types/check.go:225 +0xaa
go/types.(*Checker).Files(0xc4200ba1c0, 0xc420208e40, 0x4, 0x4, 0xc4201f3d10, 0xc4200cf960)
/usr/local/go/src/go/types/check.go:218 +0x49
go/types.(*Config).Check(0xc420216080, 0xc4200118f7, 0x7, 0xc4200138c0, 0xc420208e40, 0x4, 0x4, 0xc4201f5c70, 0x40, 0xc4200001a0, ...)
/usr/local/go/src/go/types/api.go:344 +0x1a3
main.(*Package).check(0xc420016f00, 0xc4200138c0, 0xc420208e40, 0x4, 0x4, 0x0, 0xc4201c9680)
/usr/local/go/src/cmd/vet/types.go:76 +0x370
main.doPackage(0x2cd6e4, 0x1, 0xc42000a1a0, 0x4, 0x4, 0x0, 0x1)
/usr/local/go/src/cmd/vet/main.go:336 +0x999
main.main()
/usr/local/go/src/cmd/vet/main.go:244 +0x345
exit status 2
make: *** [vet] Error 1
@dperny Thanks for the report. It may be possible to get this error when mixing packages using the old (textual) export format, and the new (binary) export format. The 1.7 compiler tries to be compatible to two export formats, and perhaps that's not a good idea. Maybe it should just flat-out reject packages using the old format. Then users would simply be prompted to recompile their packages.
I started facing this issue now
@dmportella Your comment on this closed issue is not actionable. If you see a new problem (with one of the 1.8 release candidates), please file a new issue with details so the problem can be reproduced. Thanks.
@griesemer its oke I think after running
$ go install
Everything started working
Most helpful comment
@griesemer nevermind, after cleaning my GOPATH the issue is gone. Thank you!