You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(go-tool) Support for Go Tool Invocation (#47)
feat: Adds --hook:go-tool* arguments to invoke a hook's command via 'go tool'
feat: Adds go-hook* hooks to explicitly invoke go tool with custom arguments
docs: Updates README.md and sample-config.yaml for go-tool support
fix: Small bug in prepare-my-cmd.bash
chore: Run pre-commit hooks and fix shellcheck/shfmt warnings
@@ -45,6 +51,13 @@ You can copy/paste the following snippet into your `.pre-commit-config.yaml` fil
45
51
- id: go-build-repo-mod
46
52
- id: go-build-repo-pkg
47
53
#
54
+
# Go Tool (Go 1.24+)
55
+
#
56
+
- id: go-tool
57
+
- id: go-tool-mod
58
+
- id: go-tool-repo
59
+
- id: go-tool-repo-mod
60
+
#
48
61
# Go Mod Tidy
49
62
#
50
63
- id: go-mod-tidy
@@ -234,6 +247,33 @@ You can pass multiple `--hook:env:` arguments.
234
247
235
248
The arguments can appear anywhere in the `args:` list.
236
249
250
+
#### Invoking Hooks Via go tool
251
+
You can invoke hooks via `go tool` to ensure that a specific version of a tool is used (requires Go 1.24+).
252
+
253
+
This feature is enabled via support for several specially-formatted arguments:
254
+
255
+
* `--hook:go-tool` : Invoke the hook via `go tool <hook> ...`
256
+
* `--hook:go-tool-mod=FILE` : Pass `-modfile=FILE` to the `go tool` invocation.
257
+
* `--hook:go-tool-arg:ARG` : Pass `ARG` to the `go tool` invocation (can be repeated).
258
+
259
+
The hook script will detect these arguments and invoke the configured tool via `go tool`.
260
+
261
+
**NOTE:** When using `go-tool-mod` or `go-tool-arg` flags, you do not need to also provide the base `go-tool` flag; their presence triggers the use of the `go tool` invocation implicitly.
262
+
263
+
The arguments can appear anywhere in the `args:` list (before the optional `--`).
264
+
265
+
**NOTE:** The plain versions of these arguments (without the `hook:` prefix) are also supported, but **ONLY** if they appear at the very beginning of the `args:` list:
0 commit comments