Skip to content

Build Fails Due to Dependency Version Mismatch #14

Open
@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/rylio/ytdl in github.com/rylio/ytdl v1.0.4
go: found github.com/boltdb/bolt in github.com/boltdb/bolt v1.3.1
go: github.com/Necroforger/dgrouter/examples/soundboard imports
        github.com/rylio/ytdl: github.com/rylio/[email protected]: parsing go.mod:
        module declares its path as: github.com/Andreychik32/ytdl
                but was required as: github.com/rylio/ytdl

Result

The build fails with errors related to mismatched module path.

The error dependency is github.com/rylio/ytdl.

Reason

The error log suggests module path declaration github.com/Andreychik32/ytdl in go.mod, which is inconsistent with import path github.com/rylio/ytdl .

Proposed Solution

Solution 1

To resolve this issue, we analyzed the project and identified the correct versions of the required dependencies.

The analysis shows that the correct version for the dependency github.com/rylio/ytdl is v0.6.4-0.20200704120437-0e89aa6a1554. This version has correct module path declaration.

Consider adopting this suggested version to prevent other developers from encountering build failures when constructing the project.

Solution 2

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/rylio/ytdl => github.com/Andreychik32/ytdl v1.0.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/boltdb/bolt v0.0.0-20140309034556-4e252b8a7f3d

replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.1.1

require github.com/rylio/ytdl v0.6.4-0.20200704120437-0e89aa6a1554

require github.com/bwmarrin/discordgo v0.13.1-0.20161226002214-b377944b9781

require github.com/fsnotify/fsnotify v1.4.8-0.20180830154821-1d13583d846e

require github.com/json-iterator/go v1.1.11-0.20201113075842-1779031cdaac // indirect

replace github.com/gocolly/colly => github.com/gocolly/colly/v2 v2.1.1-0.20210605141920-2f0994161301

replace github.com/pion/rtp => github.com/pion/rtp/v2 v2.0.1-0.20230316083807-c3fa0c341d91

require github.com/antchfx/jsonquery v1.3.1 // indirect

require github.com/gorilla/websocket v1.4.1 // indirect

require github.com/andersfylling/disgord v0.16.2

require (
	github.com/jonas747/dca v0.0.0-20210930103944-155f5e5f0cc7
	github.com/rs/zerolog v1.19.0 // indirect
)

require (
	github.com/BurntSushi/toml v0.3.1 // indirect
	github.com/andersfylling/snowflake/v4 v4.0.2 // indirect
	github.com/antchfx/xpath v1.2.2 // indirect
	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
	github.com/jonas747/ogg v0.0.0-20161220051205-b4f6f4cf3757 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.1 // indirect
	go.uber.org/atomic v1.5.0 // indirect
	go.uber.org/multierr v1.4.0 // indirect
	go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee // indirect
	go.uber.org/zap v1.12.0 // indirect
	golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf // indirect
	golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
	golang.org/x/net v0.0.0-20191101175033-0deb6923b6d9 // indirect
	golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect
	golang.org/x/tools v0.0.0-20191104232314-dc038396d1f0 // indirect
	honnef.co/go/tools v0.0.1-2019.2.3 // indirect
	nhooyr.io/websocket v1.7.4 // 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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions