Skip to content

Makefile: Move Go tools into tools module#407

Open
timflannagan wants to merge 1 commit intoagentregistry-dev:mainfrom
timflannagan:refactor/tools
Open

Makefile: Move Go tools into tools module#407
timflannagan wants to merge 1 commit intoagentregistry-dev:mainfrom
timflannagan:refactor/tools

Conversation

@timflannagan
Copy link
Copy Markdown
Collaborator

Description

We moved executable Go tooling into a dedicated tools module and wired make targets and scripts to run tools through go tool with a modfile override.

The lint workflow now runs our make targets directly and no longer depends on the third-party golangci action. This also committed formatter changes from golangci-lint --fix so the tree matches the new lint behavior.

Fixes #377

Change Type

/kind cleanup

Changelog

NONE

Additional Notes

We moved executable Go tooling into a dedicated tools module and wired make
targets and scripts to run tools through go tool with a modfile override.

The lint workflow now runs our make targets directly and no longer depends on
the third-party golangci action.

This also committed formatter changes from golangci-lint --fix so the tree
matches the new lint behavior.
Comment on lines +9 to +13
# Use kind via go tool directives (tools/go.mod) so no separate install step is needed.
# Override KIND to use a different binary or command.
TOOLS_MODFILE="${TOOLS_MODFILE:-${REPO_ROOT}/tools/go.mod}"
KIND="${KIND:-go tool -modfile=${TOOLS_MODFILE} kind}"
read -r -a KIND_TOOL <<<"${KIND}"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

TODO: AI generated, but this should be improved.


go 1.25.7

tool (
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should add helm as well in the future

with:
version: v2.8.0
- name: Lint Go
run: make lint
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

TODO: Override the arg variable since --fix is enabled by default

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR relocates executable Go tooling (kind, gotestsum, golangci-lint) into a dedicated tools Go module and updates local/CI entrypoints to invoke tools via go tool with a -modfile override, eliminating the previously broken lint target.

Changes:

  • Add a tools/ Go module (tools/go.mod, tools/go.sum) to manage Go tool dependencies via tool (...).
  • Update Makefile and scripts/kind/setup-kind.sh to run kind, gotestsum, and golangci-lint via the tools module (-modfile=tools/go.mod).
  • Simplify the Go lint GitHub workflow to run make lint instead of using golangci-lint-action.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/go.mod Introduces a dedicated tools module and declares tool executables in tool (...).
tools/go.sum Adds the dependency lockfile for the tools module.
Makefile Wires tool execution through go tool -modfile=tools/go.mod and updates Kind/lint/mod targets accordingly.
scripts/kind/setup-kind.sh Uses the tools module modfile when invoking kind, with override support.
.github/workflows/lint.yml Replaces the third-party golangci action with make lint.
go.mod Removes tool declarations from the root module and adjusts indirect deps accordingly.
go.sum Drops sums for deps that moved out of the root module.
internal/cli/mcp/frameworks/python/generator.go Switches from WriteString(fmt.Sprintf(...)) to fmt.Fprintf(...).
internal/cli/agent/tui/mcp_wizard.go Switches from WriteString(fmt.Sprintf(...)) to fmt.Fprintf(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +238 to 247
gotest.tools/v3 v3.5.2 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20251125145642-4e65d59e963e // indirect
mvdan.cc/sh/v3 v3.7.0 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/kind v0.31.0 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/release-utils v0.6.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This PR removes the root-module tool (...) entries for sigs.k8s.io/kind, but e2e/e2e_test.go still checks for Kind via go tool kind version. After this change, that prerequisite check will fail unless the user already has kind installed globally. Consider updating the e2e prerequisite check to run Kind via the tools module (e.g., using go tool -modfile=tools/go.mod kind ...) or otherwise sourcing the same command path used by the Makefile/scripts.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken lint Makefile target

2 participants