猿问

去兽医恐慌:不一致的进口

当我跑的时候go vet ./...,我去 vet 对以下输出感到恐慌:


% 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)


大话西游666
浏览 190回答 1
1回答

弑天下

当$GOPATH/pkg升级 go 版本后有任何不兼容的文件时,就会发生这种情况。清理您的 GOPATH/pkg 并重新构建以解决此问题。rm -rf $GOPATH/pkg/go buildgo vet ./...
随时随地看视频慕课网APP

相关分类

Go
我要回答