Juggler icon indicating copy to clipboard operation
Juggler copied to clipboard

Build Fails Due to Dependency Version Mismatch

Open deer8888 opened this issue 11 months ago • 2 comments

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/oschwald/geoip2-golang in github.com/oschwald/geoip2-golang v1.11.0
go: github.com/C4o/Juggler/web imports
        github.com/Shopify/sarama: github.com/Shopify/[email protected]: parsing go.mod:
        module declares its path as: github.com/IBM/sarama
                but was required as: github.com/Shopify/sarama

Result

The build fails with errors related to mismatched module path.

The error dependency is github.com/Shopify/sarama.

Reason

The error log suggests module path declaration github.com/IBM/sarama in go.mod, which is inconsistent with import path github.com/Shopify/sarama .

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/Shopify/sarama => github.com/IBM/sarama v1.40.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/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect

require github.com/golang/snappy v0.0.4 // indirect

require github.com/modern-go/concurrent v0.0.0-20180301064101-938152ca6a93 // indirect

require github.com/klauspost/compress v1.17.9 // indirect

require github.com/oschwald/geoip2-golang v1.9.1-0.20231207034334-3e6492ba76b8

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

require github.com/json-iterator/go v1.1.11

require github.com/eapache/queue v1.1.0 // indirect

require github.com/BurntSushi/toml v0.1.1-0.20141028230016-237e94649a23

require github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect

replace github.com/Shopify/toxiproxy => github.com/Shopify/toxiproxy/v2 v2.4.1-0.20220321102916-9bbcfb12ad96

require github.com/hashicorp/go-multierror v1.1.1 // indirect

require github.com/gin-contrib/gzip v0.0.2-0.20200604070745-9c0fc5d7af31

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

require github.com/eapache/go-resiliency v1.7.0 // indirect

replace github.com/pierrec/lz4 => github.com/pierrec/lz4/v3 v3.0.2

require github.com/fsnotify/fsnotify v1.4.8

require github.com/jcmturner/gofork v1.7.6 // indirect

require github.com/yuin/gopher-lua v0.0.0-20160304061746-784e500ada58

replace github.com/Shopify/sarama => github.com/IBM/sarama v1.40.1

require (
	github.com/Shopify/sarama v0.0.0-00010101000000-000000000000
	github.com/gin-gonic/gin v1.6.3
	github.com/google/btree v1.1.3
)

require (
	github.com/davecgh/go-spew v1.1.1 // indirect
	github.com/gin-contrib/sse v0.1.0 // indirect
	github.com/go-playground/locales v0.13.0 // indirect
	github.com/go-playground/universal-translator v0.17.0 // indirect
	github.com/go-playground/validator/v10 v10.2.0 // indirect
	github.com/golang/protobuf v1.3.3 // indirect
	github.com/hashicorp/errwrap v1.0.0 // indirect
	github.com/hashicorp/go-uuid v1.0.3 // indirect
	github.com/jcmturner/aescts/v2 v2.0.0 // indirect
	github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
	github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
	github.com/jcmturner/rpc/v2 v2.0.3 // indirect
	github.com/kr/text v0.2.0 // indirect
	github.com/leodido/go-urn v1.2.0 // indirect
	github.com/mattn/go-isatty v0.0.12 // indirect
	github.com/oschwald/maxminddb-golang v1.12.0 // indirect
	github.com/pierrec/lz4/v4 v4.1.21 // indirect
	github.com/rogpeppe/go-internal v1.6.1 // indirect
	github.com/ugorji/go/codec v1.1.7 // indirect
	golang.org/x/crypto v0.26.0 // indirect
	golang.org/x/net v0.28.0 // indirect
	golang.org/x/sync v0.8.0 // indirect
	golang.org/x/sys v0.23.0 // indirect
	gopkg.in/yaml.v2 v2.2.8 // 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 avatar Feb 25 '25 11:02 deer8888

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

deer8888 avatar Feb 25 '25 11:02 deer8888

You can try to rebuild.

C4o avatar Feb 25 '25 12:02 C4o