Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Fails Due to Dependency Version Mismatch #188

Open
deer8888 opened this issue Feb 22, 2025 · 3 comments
Open

Build Fails Due to Dependency Version Mismatch #188

deer8888 opened this issue Feb 22, 2025 · 3 comments

Comments

@deer8888
Copy link

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/namecoin/crosssignnameconstraint in github.com/namecoin/crosssignnameconstraint v0.0.3
go: github.com/namecoin/ncdns imports
        gopkg.in/hlandau/easyconfig.v1 imports
        gopkg.in/hlandau/easyconfig.v1/adaptflag imports
        gopkg.in/alecthomas/kingpin.v2: gopkg.in/alecthomas/kingpin.v2@v2.4.0: parsing go.mod:
        module declares its path as: github.com/alecthomas/kingpin/v2
                but was required as: gopkg.in/alecthomas/kingpin.v2

Result

The build fails with errors related to mismatched module path.

The error dependency is gopkg.in/alecthomas/kingpin.v2.

Reason

The error log suggests module path declaration github.com/alecthomas/kingpin/v2 in go.mod, which is inconsistent with import path gopkg.in/alecthomas/kingpin.v2 .

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 gopkg.in/alecthomas/kingpin.v2 is v2.2.6. 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 gopkg.in/alecthomas/kingpin.v2 => github.com/alecthomas/kingpin/v2 v2.4.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/ogier/pflag v0.0.0-20120426231359-29d09b85d463 // indirect

require github.com/namecoin/splicesign v0.0.0-20201122102502-241f06e8c39a

require github.com/kr/pretty v0.2.0

replace github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.2.1-0.20210316152429-27bf5a9638be

require github.com/namecoin/tlsrestrictnss v0.0.4

require github.com/kr/text v0.1.0 // indirect

require github.com/stretchr/testify v1.8.5-0.20231030230055-1837f62a5f28 // indirect

require github.com/miekg/dns v1.1.62

require github.com/hlandau/degoutils v0.0.0-20161011040956-8fa2440b6344

require github.com/golang/groupcache v0.0.0-20130724010306-6dad98a78370

require github.com/btcsuite/btcd v0.24.3-0.20241008124144-019988b69614

require github.com/hlandau/dexlogconfig v0.0.0-20220319061320-5b58eada1a09

require github.com/namecoin/crosssignnameconstraint v0.0.3-0.20180808023605-4954f44076cd // indirect

require github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect

require github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect

require (
	github.com/hlandau/buildinfo v0.0.0-20161112115716-337a29b54997
	github.com/hlandau/nctestsuite v0.0.0-20151129185958-a9b78806c85c
	github.com/hlandau/xlog v1.0.0
	github.com/namecoin/certinject v0.1.1
	github.com/namecoin/ncbtcjson v0.1.0
	github.com/namecoin/ncrpcclient v0.1.0
	github.com/namecoin/x509-compressed v0.0.3
	gopkg.in/hlandau/easyconfig.v1 v1.0.18
	gopkg.in/hlandau/madns.v2 v2.0.2
	gopkg.in/hlandau/service.v2 v2.0.17
)

require (
	github.com/BurntSushi/toml v0.3.1 // indirect
	github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
	github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
	github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
	github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
	github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
	github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
	github.com/coreos/go-systemd v0.0.0-00010101000000-000000000000 // indirect
	github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
	github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
	github.com/erikdubbelboer/gspt v0.0.0-20210805194459-ce36a5128377 // indirect
	github.com/mattn/go-isatty v0.0.2 // indirect
	github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
	golang.org/x/crypto v0.25.0 // indirect
	golang.org/x/mod v0.18.0 // indirect
	golang.org/x/net v0.27.0 // indirect
	golang.org/x/sync v0.7.0 // indirect
	golang.org/x/sys v0.22.0 // indirect
	golang.org/x/tools v0.22.0 // indirect
	gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
	gopkg.in/hlandau/configurable.v1 v1.0.1 // indirect
	gopkg.in/hlandau/svcutils.v1 v1.0.11 // 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.

@deer8888
Copy link
Author

Looking forward to your response!

Could we update README.md to help other developers use the Go module to build the projects or submit pull requests with go.mod to apply our suggestions?
@JeremyRand

@JeremyRand
Copy link
Member

JeremyRand commented Feb 24, 2025 via email

@deer8888
Copy link
Author

I have developed a tool to help developers rebuild projects and migrate from GoPath to Go Modules, and I look forward to receiving your feedback. Since easyconfig is no longer maintained, it might be better to include go.mod/go.sum files in this repo. Submitting an ISSUE is to obtain your permission. I'm sorry to bother you, but if possible, I can submit a PR.
@JeremyRand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants