gpt4 book ai didi

去 vert panic : inconsistent import

转载 作者:IT王子 更新时间:2023-10-29 01:39:01 28 4
gpt4 key购买 nike

当我运行 go vet ./... 时,go vet panic ,输出如下:

% 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

最佳答案

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

rm -rf $GOPATH/pkg/
go build
go vet ./...

关于去 vert panic : inconsistent import,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39341513/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com