go: cmd/vet: inconsistent import
Please answer these questions before submitting your issue. Thanks!
- What version of Go are you using (
go version
)?
go version devel +d4ed8da Wed May 18 08:19:51 2016 +0000 linux/amd64
- What operating system and processor architecture are you using (
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"
- What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.
I did go vet ./... to check my program.
- What did you expect to see?
Error or lack of error, but not panic.
- What did you see instead?
$ 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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- bash_profile: back to go 1.6.2 Because golang/go#15728. — committed to fsouza/dotfiles-old by fsouza 8 years ago
- bash_profile: back to go 1.6.2 Because golang/go#15728. — committed to fsouza/dotfiles-old by fsouza 8 years ago
@griesemer nevermind, after cleaning my GOPATH the issue is gone. Thank you!
@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 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:
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
.