Skip to content

Build Fails Due to Dependency Version Mismatch #579

@deer8888

Description

@deer8888

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 launchpad.net/gocheck in launchpad.net/gocheck v0.0.0-20140225173054-000000000087
go: github.com/nytlabs/streamtools/st/library imports
        github.com/bitly/go-nsq: github.com/bitly/go-nsq@v1.1.0: parsing go.mod:
        module declares its path as: github.com/nsqio/go-nsq
                but was required as: github.com/bitly/go-nsq

Result

The build fails with errors related to mismatched module path.

The error dependency is github.com/bitly/go-nsq.

Reason

The error log suggests module path declaration github.com/nsqio/go-nsq in go.mod, which is inconsistent with import path github.com/bitly/go-nsq .

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/bitly/go-nsq => github.com/nsqio/go-nsq v1.0.9-0.20210115093248-6d8e101adcca. 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:


replace github.com/bitly/go-nsq => github.com/nsqio/go-nsq v1.0.9-0.20210115093248-6d8e101adcca

require (
	github.com/bitly/go-nsq v0.0.0-00010101000000-000000000000
	github.com/garyburd/redigo v1.6.4
	github.com/goamz/goamz v0.0.0-20180131231218-8b901b531db8
	github.com/gorilla/mux v1.8.1
	github.com/gorilla/websocket v1.5.3
	github.com/jasoncapehart/go-sgd v0.0.0-20140417161455-a7e66bc0f279
	github.com/mattbaird/elastigo v0.0.0-20170123220020-2fe47fd29e4b
	github.com/mjibson/go-dsp v0.0.0-20180508042940-11479a337f12
	github.com/mrmorphic/hwio v0.0.0-20180519033216-11ea3f481a14
	github.com/mxk/go-imap v0.0.0-20150429134902-531c36c3f12d
	github.com/nutrun/lentil v0.0.0-20160922095934-a0aa7412e0f7
	github.com/nytlabs/gojee v0.0.0-20140331152115-5a79a1542dc0
	github.com/nytlabs/mxj v0.0.0-20140325221504-70c0faeef2e6
	github.com/robertkrimen/otto v0.5.1
	github.com/streadway/amqp v1.1.0
	labix.org/v2/mgo v0.0.0-20140701140051-000000000287
	launchpad.net/gocheck v0.0.0-20140225173054-000000000087
)

require (
	github.com/araddon/gou v0.0.0-20211019181548-e7d08105776c // indirect
	github.com/bitly/go-hostpool v0.1.0 // indirect
	github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
	github.com/clbanning/mxj v1.8.4 // indirect
	github.com/golang/snappy v0.0.1 // indirect
	github.com/nsqio/go-nsq v1.1.0 // indirect
	github.com/smartystreets/goconvey v1.8.1 // indirect
	github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec // indirect
	golang.org/x/text v0.4.0 // indirect
	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
	gopkg.in/sourcemap.v1 v1.0.5 // 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions