Skip to content

Manage tools with Go modules - #222

Open
nojnhuh wants to merge 1 commit into
kubernetes-sigs:mainfrom
nojnhuh:tools
Open

Manage tools with Go modules#222
nojnhuh wants to merge 1 commit into
kubernetes-sigs:mainfrom
nojnhuh:tools

Conversation

@nojnhuh

@nojnhuh nojnhuh commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This change implements the approach described in #192 to manage tool dependencies like golangci-lint, helm, and conversion-gen among others:

  • hack/tools/go.{mod,sum} record tool dependencies
    • Add a new dependency
      • go get -modfile hack/tools/go.mod -tool <module path>
      • e.g. go get -modfile hack/tools/go.mod -tool helm.sh/helm/v4/cmd/helm@v4.2.0
    • Run a tool
      • go tool -modfile hack/tools/go.mod <tool>
        • e.g. go tool -modfile hack/tools/go.mod kind version
  • hack/tools/golangci-lint/go.{mod,sum} is a module only for golangci-lint since they claim to be particularly sensitive to dependency versions.
    • make lint invokes the tool version.

Notably, building and running the driver locally may not have depended on a local Go installation before, but now it does. Running all of the scripts in a dev container with Go installed probably still works, but I'm open to fixing issues.

Fixes #192

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
k8s-ci-robot requested review from bart0sh and klueska June 12, 2026 03:42
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 12, 2026
github.com/golangci/dupl v0.0.0-20260401084720-c99c5cf5c202 // indirect
github.com/golangci/go-printf-func-name v0.1.1 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/golangci-lint/v2 v2.12.1 // indirect

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentionally out of date to make sure dependabot is wired up correctly for this new module.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve tool dependency management

4 participants