为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

Go
大话西游666 2022-03-07 22:39:47
当我跑的时候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.Readergoroutine 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)
查看完整描述

1 回答

?
弑天下

TA贡献1818条经验 获得超8个赞

当$GOPATH/pkg升级 go 版本后有任何不兼容的文件时,就会发生这种情况。清理您的 GOPATH/pkg 并重新构建以解决此问题。


rm -rf $GOPATH/pkg/

go build

go vet ./...


查看完整回答
反对 回复 2022-03-07
  • 1 回答
  • 0 关注
  • 189 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信