Skip to content

Build Fails Due to Dependency Version Mismatch #1

Description

@back678

Description

While rebuilding the project at commit bf3cd5a using the latest version of Go, with Go's official recommendation to use Go modules for initialization and building, we found that the build process fails due to mismatched or unresolved dependencies.

The following error log was produced during the build process:

pkg/proxy/proxy.go:92:20: undefined: goetty.NewServer
pkg/proxy/proxy.go:93:10: undefined: goetty.WithServerDecoder
pkg/proxy/proxy.go:94:10: undefined: goetty.WithServerEncoder
pkg/proxy/proxy.go:128:17: undefined: goetty.NewConnector
pkg/proxy/proxy.go:129:10: undefined: goetty.WithClientDecoder
pkg/proxy/codec.go:19:37: undefined: goetty.Decoder
pkg/proxy/codec.go:24:47: undefined: goetty.ByteBuf
pkg/proxy/codec.go:33:37: undefined: goetty.Encoder
pkg/proxy/codec.go:38:66: undefined: goetty.ByteBuf
pkg/proxy/proxy.go:129:10: too many errors

Result

The build fails with errors related to missing or mismatched dependencies.

The error dependency is github.com/fagongzi/goetty.

The build process automatically pulls the latest dependency versions by default. However, the current version no longer provides APIs such as NewServer and WithServerDecoder.

Reason

This issue appears to be caused by the absence of precise version tracking in GOPATH, which leads to inconsistency in dependency resolution.

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 version for the dependency github.com/fagongzi/goetty is v1.1.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:

module github.com/fagongzi/netproxy

go 1.24.0

toolchain go1.24.10

require github.com/mattn/go-isatty v0.0.20 // indirect

require github.com/fagongzi/goetty v1.1.1

require github.com/spf13/cobra v0.0.3

require github.com/dgrijalva/jwt-go v3.2.1-0.20210710071453-614772a640cb+incompatible // indirect

require github.com/fagongzi/log v0.0.0-20170831135209-9a647df25e0e

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

require github.com/labstack/gommon v0.1.1-0.20170219023420-79a1921bbe13 // indirect

require github.com/spf13/pflag v1.0.10 // indirect

require github.com/valyala/fasttemplate v1.2.2 // indirect

require github.com/mattn/go-colorable v0.1.14 // indirect

require github.com/labstack/echo v3.3.5+incompatible

require github.com/inconshreveable/mousetrap v1.1.0 // indirect

require (
	github.com/valyala/bytebufferpool v1.0.0 // indirect
	golang.org/x/crypto v0.42.0 // indirect
	golang.org/x/net v0.44.0 // indirect
	golang.org/x/sys v0.36.0 // indirect
	golang.org/x/text v0.29.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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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