-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Description
While rebuilding the project using the latest version of Go, with Go's official recommendation to use gomodule for initialization and building, we found that the build process fails due to mismatched module path.
The following error log was produced during the build process:
......
go: found github.com/danryan/hal/handler in github.com/danryan/hal v0.0.0-20190923182548-567863289541
go: found github.com/garyburd/redigo/redis in github.com/garyburd/redigo v1.6.4
go: github.com/nvellon/hal imports
github.com/Sirupsen/logrus: github.com/Sirupsen/logrus@v1.9.3: parsing go.mod:
module declares its path as: github.com/sirupsen/logrus
but was required as: github.com/Sirupsen/logrus
Result
The build fails with errors related to mismatched module path.
The error dependency is github.com/Sirupsen/logrus.
Reason
The error log suggests module path declaration github.com/sirupsen/logrus in go.mod, which is inconsistent with import path github.com/Sirupsen/logrus .
Proposed Solution
To resolve this issue, we analyzed the project and identified the correct versions of the required dependencies.
The analysis shows that the correct declaration for the dependency is replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.0.2-0.20170713114250-a3f95b5c4235.
Consider adopting this suggested version to prevent other developers from encountering build failures when constructing the project.
This information can be documented in the README.md file or another relevant location.
Additional Suggestions
To ensure reproducible builds and align with the evolving trends of the Go programming language, it is recommended that the current project be migrated to the Go module mechanism.
Updating to the go module mechanism allows for managing third-party dependency versions through the go.mod file, which provides a centralized and consistent way to specify dependency constraints.
We have generated a go.mod file with the correct versions of the third-party dependencies needed for this project.
The suggested go.mod file is as follows:
require github.com/danryan/env v0.0.0-20140701041543-26c2fbe09221
require github.com/stretchr/testify v0.0.0-20150504220033-73a8112e0560 // indirect
require github.com/garyburd/redigo v1.3.1-0.20171229002542-2ca15d09f96c
require github.com/davecgh/go-spew v1.1.1-0.20170711162144-d0f88dafcf0f
require github.com/thoj/go-ircevent v0.0.0-20210703230944-272c4d1650c4
require (
github.com/Sirupsen/logrus v0.0.0-00010101000000-000000000000
github.com/daneharrigan/hipchat v0.0.0-20160912215519-514fe1429fb0
)
require (
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sys v0.0.0-20210423082822-04245dca01da // indirect
golang.org/x/text v0.3.6 // indirect
)
replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.0.2-0.20170713114250-a3f95b5c4235
Additional Information:
This issue was identified as part of our research project focused on automating the analysis of GOPATH projects to provide accurate dependency versions for seamless migration to Go Modules. We value your feedback and would appreciate any comments or suggestions regarding this approach.