-
Notifications
You must be signed in to change notification settings - Fork 32
Build Fails Due to Dependency Version Mismatch #16
Description
Description
While reproducing the project, we found that the build process fails due to mismatched or unresolved dependencies.
The following error log was produced during the build process:
......
go: finding module for package github.com/hashicorp/terraform/plugin
go: github.com/Pryz/terraform-provider-ldap imports
github.com/hashicorp/terraform/helper/hashcode: module github.com/hashicorp/terraform@latest found (v1.10.4), but does not contain package github.com/hashicorp/terraform/helper/hashcode
go: github.com/Pryz/terraform-provider-ldap imports
github.com/hashicorp/terraform/helper/schema: module github.com/hashicorp/terraform@latest found (v1.10.4), but does not contain package github.com/hashicorp/terraform/helper/schema
go: github.com/Pryz/terraform-provider-ldap imports
github.com/hashicorp/terraform/plugin: module github.com/hashicorp/terraform@latest found (v1.10.4), but does not contain package github.com/hashicorp/terraform/plugin
go: github.com/Pryz/terraform-provider-ldap imports
github.com/hashicorp/terraform/terraform: module github.com/hashicorp/terraform@latest found (v1.10.4), but does not contain package github.com/hashicorp/terraform/terraform
go: github.com/Pryz/terraform-provider-ldap tested by
github.com/Pryz/terraform-provider-ldap.test imports
github.com/hashicorp/terraform/helper/resource: module github.com/hashicorp/terraform@latest found (v1.10.4), but does not contain package github.com/hashicorp/terraform/helper/resource
Result
The build fails with errors related to missing or mismatched dependencies.
The error dependency is github.com/hashicorp/terraform.
The build process automatically pulls the latest dependency versions by default. However, the required package github.com/hashicorp/terraform/helper/hashcode、github.com/hashicorp/terraform/helper/schema、github.com/hashicorp/terraform/plugin、github.com/hashicorp/terraform/terraform、github.com/hashicorp/terraform/helper/resource is not included in version v1.10.4.
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/hashicorp/terraform is v0.12.18.
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/Pryz/terraform-provider-ldap
go 1.23
require (
github.com/hashicorp/terraform v0.12.18
gopkg.in/ldap.v2 v2.5.1
)
require (
cloud.google.com/go v0.45.1 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-cidr v1.0.1 // indirect
github.com/apparentlymart/go-textseg v1.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.25.3 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/bmatcuk/doublestar v1.1.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-getter v1.4.0 // indirect
github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f // indirect
github.com/hashicorp/go-multierror v1.0.0 // indirect
github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.1 // indirect
github.com/hashicorp/go-version v1.2.0 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect
github.com/hashicorp/hcl/v2 v2.0.0 // indirect
github.com/hashicorp/hcl2 v0.0.0-20190821123243-0c888d1241f6 // indirect
github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.5 // indirect
github.com/mitchellh/cli v1.0.0 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/hashstructure v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/posener/complete v1.2.1 // indirect
github.com/spf13/afero v1.2.1 // indirect
github.com/ulikunitz/xz v0.5.5 // indirect
github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect
github.com/zclconf/go-cty v1.1.0 // indirect
github.com/zclconf/go-cty-yaml v1.0.1 // indirect
go.opencensus.io v0.22.0 // indirect
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/api v0.9.0 // indirect
google.golang.org/appengine v1.6.1 // indirect
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
google.golang.org/grpc v1.21.1 // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
)
Here the +incompatible suffix in go.mod indicates that the module does not follow Go Modules' semantic versioning (SemVer) rules correctly. But Go can still build and run the project normally despite the +incompatible tag.
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.