-
Notifications
You must be signed in to change notification settings - Fork 115
Build Fails Due to Dependency Version Mismatch #8
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/lib/pq in github.com/lib/pq v1.10.9
go: found github.com/garyburd/redigo/redis in github.com/garyburd/redigo v1.6.4
go: github.com/andeya/lessgo/session/ledis imports
github.com/siddontang/ledisdb/config: github.com/siddontang/ledisdb@v0.0.0-20200510135210-d35789ec47e6: parsing go.mod:
module declares its path as: github.com/ledisdb/ledisdb
but was required as: github.com/siddontang/ledisdb
Result
The build fails with errors related to mismatched module path.
The error dependency is github.com/siddontang/ledisdb.
Reason
The error log suggests module path declaration github.com/ledisdb/ledisdb in go.mod, which is inconsistent with import path github.com/siddontang/ledisdb .
Proposed Solution
Solution 1
To resolve this issue, we analyzed the project and identified the correct versions of the required dependencies.
The analysis shows that the correct version for the dependency github.com/siddontang/ledisdb is v0.0.0-20200423090020-179e66814f05. This version has correct module path declaration.
Consider adopting this suggested version to prevent other developers from encountering build failures when constructing the project.
Solution 2
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/siddontang/ledisdb => github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6. This version is the latest version of the dependency.
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/henrylee2cn/lessgo v1.0.0
require github.com/couchbase/gomemcached v0.2.1 // indirect
require github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0 // indirect
require github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112 // indirect
require github.com/pelletier/go-toml v1.8.1 // indirect
require github.com/garyburd/redigo v1.0.1-0.20170426182455-d389460dbb88
require github.com/couchbase/go-couchbase v0.0.0-20150909085553-c364b10b2b96
require github.com/siddontang/ledisdb v0.0.0-20200423090020-179e66814f05
require github.com/henrylee2cn/tconfig v0.0.0-20160514130608-aa60c5ddf829
require github.com/couchbase/goutils v0.1.2 // indirect
require (
github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
github.com/facebookgo/grace v0.0.0-20180706040059-75cf19382434
github.com/go-sql-driver/mysql v1.9.0
github.com/henrylee2cn/lessgoext v0.0.0-20170109080453-5efdb7c2e58e
github.com/lib/pq v1.10.9
golang.org/x/sys v0.30.0
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.1 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/freeport v0.0.0-20150612182905-d4adf43b75b9 // indirect
github.com/facebookgo/httpdown v0.0.0-20180706035922-5979d39b15c2 // indirect
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
github.com/facebookgo/stats v0.0.0-20151006221625-1b76add642e4 // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/golang/snappy v0.0.0-20170215233205-553a64147049 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d // indirect
github.com/stretchr/testify v1.10.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.21.0 // indirect
)
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.