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 #13

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

Build Fails Due to Dependency Version Mismatch #13

deer8888 opened this issue Feb 22, 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/ashwanthkumar/slack-go-webhook in github.com/ashwanthkumar/slack-go-webhook v0.0.0-20200209025033-430dd4e66960
go: github.com/trivago/scalad imports
        github.com/Sirupsen/logrus: github.com/Sirupsen/[email protected]: 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 v0.4.1.

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/prometheus/client_model v0.2.0 // indirect

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

require github.com/beorn7/perks v1.0.1 // indirect

replace github.com/pressly/chi => github.com/go-chi/chi/v5 v5.1.1-0.20240917135704-39703bcb03f6

replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v0.4.1

require github.com/prometheus/common v0.36.0 // indirect

require github.com/parnurzeal/gorequest v0.2.15-0.20170405165552-8842d704272f // indirect

require github.com/prometheus/procfs v0.10.1 // indirect

require github.com/golang/protobuf v1.5.2 // indirect

require github.com/prometheus/client_golang v1.12.1

require github.com/go-chi/chi v4.0.3-0.20191001142944-2171e2a8965d+incompatible

require (
	github.com/Sirupsen/logrus v0.0.0-00010101000000-000000000000
	github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
	github.com/ashwanthkumar/slack-go-webhook v0.0.0-20181115084212-ba89a17cf174
	github.com/hashicorp/nomad/api v0.0.0-20250220215614-3f764a21bc5c
	github.com/karrick/tparse/v2 v2.8.2
)

require (
	github.com/cespare/xxhash/v2 v2.1.2 // indirect
	github.com/elazarl/goproxy v1.7.0 // indirect
	github.com/gorilla/websocket v1.5.0 // indirect
	github.com/hashicorp/cronexpr v1.1.2 // indirect
	github.com/hashicorp/errwrap v1.0.0 // indirect
	github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
	github.com/hashicorp/go-multierror v1.1.1 // indirect
	github.com/hashicorp/go-rootcerts v1.0.2 // indirect
	github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
	github.com/mitchellh/go-homedir v1.1.0 // indirect
	github.com/mitchellh/mapstructure v1.5.0 // indirect
	github.com/moul/http2curl v1.0.0 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/smartystreets/goconvey v1.8.1 // indirect
	golang.org/x/net v0.34.0 // indirect
	golang.org/x/sys v0.29.0 // indirect
	google.golang.org/protobuf v1.26.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.

@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?
@jvineet

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

1 participant