gpt4 book ai didi

go - 运行go build时出错。带日志 repo

转载 作者:行者123 更新时间:2023-12-01 20:09:15 25 4
gpt4 key购买 nike

我有一个带有gomod的Go程序,当我运行go build .时出现以下错误:

go: github.com/sirupsen/logrus@v1.4.2 used for two different module paths (github.com/Sirupsen/logrus and github.com/sirupsen/logrus)



我的go mod看起来像
require (

github.com/Sirupsen/logrus v1.4.2 // indirect
github.com/sirupsen/logrus v1.4.2



)

并且我添加了以下内容,对您没有帮助吗?
replace (
github.com/Sirupsen/logrus v1.4.2 => github.com/sirupsen/logrus v1.4.2
)

在我的 项目代码中,我将 import路径与小写字母一起使用 github.com/sirupsen/logrus

最佳答案

尝试删除//indirect行,然后运行

go mod tidy # prune any extraneous requirements + other stuff
go clean # remove object files and cached files
go get -v -u all # update everything related to the dependencies
go build # finger crossed!

关于go - 运行go build时出错。带日志 repo ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58500310/

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