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/google/btree in github.com/google/btree v1.1.3
go: found github.com/yinqiwen/gotoolkit/gfwlist in github.com/yinqiwen/gotoolkit v0.0.0-20200524133648-3980351e079f
go: github.com/yinqiwen/gsnova/common/channel/quic imports
github.com/lucas-clemente/quic-go: github.com/lucas-clemente/[email protected]: parsing go.mod:
module declares its path as: github.com/quic-go/quic-go
but was required as: github.com/lucas-clemente/quic-go
Result
The build fails with errors related to mismatched module path.
The error dependency is github.com/lucas-clemente/quic-go
.
Reason
The error log suggests module path declaration github.com/quic-go/quic-go
in go.mod, which is inconsistent with import path github.com/lucas-clemente/quic-go
.
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/lucas-clemente/quic-go
is v0.15.4. 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/lucas-clemente/quic-go => github.com/quic-go/quic-go v0.46.0
. 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/onsi/gomega v1.27.1 // indirect
replace github.com/hashicorp/golang-lru => github.com/hashicorp/golang-lru/v2 v2.0.6-0.20230821173505-1e956f57ce74
require github.com/lucas-clemente/quic-go v0.15.4
require github.com/google/easypki v1.0.0
require github.com/golang/protobuf v1.5.2 // indirect
require github.com/pkg/errors v0.8.1 // indirect
require github.com/francoispqt/gojay v1.2.13 // indirect
require github.com/yinqiwen/pmux v0.0.0-20180519143818-b97cd60f24e7
require github.com/tjfoc/gmsm v1.3.1 // indirect
replace github.com/go-redis/redis => github.com/go-redis/redis/v8 v8.0.0-beta.10
require github.com/NebulousLabs/go-upnp v0.0.0-20181203152547-b32978b8ccbf
require github.com/juju/ratelimit v0.0.0-20171026082551-5e0a5818cfe6
require github.com/onsi/ginkgo v1.14.1 // indirect
// require github.com/vmihailenco/msgpack v2.1.4
replace github.com/NebulousLabs/fastrand => github.com/awnumar/fastrand v0.0.0-20190721151247-0a4f9b9b066c
require github.com/yinqiwen/gotoolkit v0.0.0-20190310031920-895308938932
require github.com/miekg/dns v1.1.62
// require github.com/klauspost/reedsolomon 0.1.0
require github.com/cheekybits/genny v1.0.0 // indirect
replace github.com/codegangsta/cli => github.com/urfave/cli v1.21.0
require github.com/dsnet/compress v0.0.0-20160922072019-f99eaf48ea6d
require github.com/xtaci/lossyconn v0.0.0-20190528080024-9d0ed3a7f59e // indirect
require github.com/fsnotify/fsnotify v1.4.9
require github.com/gorilla/websocket v1.0.1-0.20160718230834-5e2e56d5dfd4
require (
github.com/golang/snappy v0.0.4
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/xtaci/kcp-go v5.4.20+incompatible
github.com/yinqiwen/fdns v0.0.0-20171017112320-12371043eaab
golang.org/x/crypto v0.25.0
golang.org/x/net v0.27.0
golang.org/x/sys v0.24.0
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
)
require (
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/klauspost/reedsolomon v1.12.4 // indirect
github.com/marten-seemann/qtls v0.9.0 // indirect
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 // indirect
gitlab.com/NebulousLabs/go-upnp v0.0.0-20211002182029-11da932010b6 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/appengine v1.4.0 // indirect
google.golang.org/protobuf v1.28.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.