Skip to content
New issue

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

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

Already on GitHub? # to your account

Build Fails Due to Dependency Version Mismatch #64

Open
deer8888 opened this issue Feb 21, 2025 · 1 comment
Open

Build Fails Due to Dependency Version Mismatch #64

deer8888 opened this issue Feb 21, 2025 · 1 comment

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/docker/docker/api/types/filters in github.com/docker/docker v27.2.0+incompatible
go: github.com/gianarb/orbiter imports
        github.com/Sirupsen/logrus: github.com/Sirupsen/logrus@v1.9.3: parsing go.mod:
        module declares its path as: github.com/sirupsen/logrus
                but was required as: github.com/Sirupsen/logrus

Result

The build fails with errors related to mismatched module path.

The error dependency is github.com/Sirupsen/logrus.

Reason

The error log suggests module path declaration github.com/sirupsen/logrus in go.mod, which is inconsistent with import path github.com/Sirupsen/logrus .

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/Sirupsen/logrus => github.com/sirupsen/logrus v1.8.2.

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/Sirupsen/logrus => github.com/sirupsen/logrus v1.8.2

require (
	github.com/Sirupsen/logrus v0.0.0-00010101000000-000000000000
	github.com/docker/docker v27.5.1+incompatible
	github.com/gorilla/mux v1.8.1
	github.com/mitchellh/cli v1.1.5
	github.com/pkg/errors v0.9.1
)

require (
	github.com/Masterminds/goutils v1.1.1 // indirect
	github.com/Masterminds/semver/v3 v3.1.1 // indirect
	github.com/Masterminds/sprig/v3 v3.2.1 // indirect
	github.com/Microsoft/go-winio v0.4.14 // indirect
	github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 // indirect
	github.com/bgentry/speakeasy v0.1.0 // indirect
	github.com/containerd/log v0.1.0 // indirect
	github.com/distribution/reference v0.6.0 // indirect
	github.com/docker/go-connections v0.5.0 // indirect
	github.com/docker/go-units v0.5.0 // indirect
	github.com/fatih/color v1.7.0 // indirect
	github.com/felixge/httpsnoop v1.0.4 // indirect
	github.com/go-logr/logr v1.4.2 // indirect
	github.com/go-logr/stdr v1.2.2 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/hashicorp/errwrap v1.0.0 // indirect
	github.com/hashicorp/go-multierror v1.0.0 // indirect
	github.com/huandu/xstrings v1.3.2 // indirect
	github.com/imdario/mergo v0.3.11 // indirect
	github.com/mattn/go-colorable v0.0.9 // indirect
	github.com/mattn/go-isatty v0.0.3 // indirect
	github.com/mitchellh/copystructure v1.0.0 // indirect
	github.com/mitchellh/reflectwalk v1.0.0 // indirect
	github.com/moby/docker-image-spec v1.3.1 // indirect
	github.com/moby/term v0.5.2 // indirect
	github.com/morikuni/aec v1.0.0 // indirect
	github.com/opencontainers/go-digest v1.0.0 // indirect
	github.com/opencontainers/image-spec v1.1.0 // indirect
	github.com/posener/complete v1.1.1 // indirect
	github.com/shopspring/decimal v1.2.0 // indirect
	github.com/sirupsen/logrus v1.9.3 // indirect
	github.com/spf13/cast v1.3.1 // indirect
	go.opentelemetry.io/auto/sdk v1.1.0 // indirect
	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
	go.opentelemetry.io/otel v1.34.0 // indirect
	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
	go.opentelemetry.io/otel/metric v1.34.0 // indirect
	go.opentelemetry.io/otel/sdk v1.34.0 // indirect
	go.opentelemetry.io/otel/trace v1.34.0 // indirect
	golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
	golang.org/x/sys v0.29.0 // indirect
	golang.org/x/time v0.10.0 // indirect
	gotest.tools/v3 v3.5.2 // 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?
@gianarb

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

No branches or pull requests

1 participant