Skip to content

Build Fails Due to Dependency Version Mismatch #235

@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 github.com/fatih/color in github.com/fatih/color v1.17.0
go: github.com/koding/kite/kontrol imports
        github.com/lann/squirrel: github.com/lann/[email protected]: parsing go.mod:
        module declares its path as: github.com/Masterminds/squirrel
                but was required as: github.com/lann/squirrel

Result

The build fails with errors related to mismatched module path.

The error dependency is github.com/lann/squirrel.

Reason

The error log suggests module path declaration github.com/Masterminds/squirrel in go.mod, which is inconsistent with import path github.com/lann/squirrel .

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/lann/squirrel => github.com/Masterminds/squirrel v1.5.4. 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/fatih/structs v0.0.0-20160505090436-e5ca5fe90dcf // indirect

replace github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.4-0.20200106203124-126e837046b0

require github.com/lib/pq v1.8.1-0.20200908161135-083382b7e6fc

require github.com/grpc-ecosystem/grpc-gateway v1.11.0 // indirect

replace github.com/golang-jwt/jwt => github.com/golang-jwt/jwt/v4 v4.4.3-0.20220926140152-0c4e38798546

require github.com/golang/groupcache v0.0.0-20170421005642-b710c8433bd1 // indirect

require github.com/mitchellh/cli v0.0.0-20160201180959-82b28612c6ca

require github.com/koding/logging v0.0.0-20140310081431-fff4c160f6dd

require github.com/fatih/camelcase v0.0.0-20150419180113-207c404d5f91 // indirect

require github.com/koding/cache v0.0.0-20160107191205-704055ea875a

require github.com/soheilhy/cmux v0.0.0-20150730150307-0417b90d39e1 // indirect

// require github.com/coreos/etcd v3.0.0-beta.0
require github.com/jonboulle/clockwork v0.2.3 // indirect

require github.com/gogo/protobuf v0.0.0-20171108112821-3813b83578b9 // indirect

require github.com/satori/go.uuid v1.2.1-0.20180318171246-6b362869be00

require github.com/gorilla/mux v1.3.1-0.20170520225546-1856953e530e

require github.com/armon/go-radix v0.0.0-20140801015722-519c5dd5ae35 // indirect

require github.com/xiang90/probing v0.0.0-20150804093907-11caf1c32ca4 // indirect

require github.com/gorilla/websocket v1.5.4-0.20240706001204-3810b2346f49

replace github.com/koding/websocketproxy => github.com/pretty66/websocketproxy v0.0.0-20220126060410-1e223097ea51

require github.com/google/uuid v1.2.1-0.20210331013651-512b657a4288 // indirect

require github.com/modern-go/reflect2 v1.0.2 // indirect

replace github.com/codegangsta/cli => github.com/urfave/cli/v2 v2.5.1

require github.com/coreos/pkg v0.0.0-20150429235124-2a2612570bd1 // indirect

require github.com/prometheus/client_golang v1.20.4 // indirect

require github.com/fatih/color v0.0.0-20140505101153-51482a20c556

require github.com/tmc/grpc-websocket-proxy v0.0.0-20200323084225-164c3d803b65 // indirect

require github.com/coreos/go-systemd v0.0.0-20160628072614-de4ee2875b89 // indirect

require github.com/stretchr/testify v1.10.0 // indirect

require github.com/dgrijalva/jwt-go v3.0.1-0.20170316165535-fd360ca1aa50+incompatible

require github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20180118105301-6bae80a9dfa0 // indirect

require github.com/json-iterator/go v1.1.12 // indirect

require github.com/igm/sockjs-go v0.0.0-20160309003853-23545cb0a627

require github.com/dustin/go-humanize v0.0.0-20160923163517-bd88f87ad3a4 // indirect

require github.com/coreos/go-semver v0.3.2-0.20230208192010-2cb858cb3f67 // indirect

require github.com/koding/multiconfig v0.0.0-20170701121558-7ab5923ac43f

require github.com/juju/ratelimit v1.0.2-0.20191001135536-4b7d3ddde4ec

require github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20171020063731-82921fcf811d // indirect

require github.com/hashicorp/go-version v1.2.1

require github.com/mattn/go-isatty v0.0.0-20150814002629-7fcbc72f853b // indirect

require (
	github.com/cenkalti/backoff v2.2.1+incompatible
	github.com/coreos/etcd v3.3.27+incompatible
	github.com/golang/protobuf v1.5.0 // indirect
	github.com/koding/websocketproxy v0.0.0-00010101000000-000000000000
	github.com/lann/squirrel v0.0.0-00010101000000-000000000000
	golang.org/x/crypto v0.31.0
)

require (
	github.com/BurntSushi/toml v0.3.1 // indirect
	github.com/bgentry/speakeasy v0.2.0 // indirect
	github.com/bradfitz/http2 v0.0.0-20160116213329-aa7658c0e990 // indirect
	github.com/coreos/bbolt v0.0.0-00010101000000-000000000000 // indirect
	github.com/google/btree v1.1.3 // indirect
	github.com/gorilla/context v1.1.2 // indirect
	github.com/kr/pretty v0.3.1 // indirect
	github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
	github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/prometheus/common v0.62.0 // indirect
	github.com/rogpeppe/go-internal v1.10.0 // indirect
	github.com/sirupsen/logrus v1.9.3 // indirect
	go.uber.org/zap v1.27.0 // indirect
	golang.org/x/net v0.33.0 // indirect
	golang.org/x/sys v0.28.0 // indirect
	golang.org/x/term v0.27.0 // indirect
	golang.org/x/time v0.10.0 // indirect
	google.golang.org/grpc v1.19.0 // indirect
	google.golang.org/protobuf v1.36.1 // indirect
	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/lann/squirrel => github.com/Masterminds/squirrel v1.5.4

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