From 2a2b9f3f34ea1b280ea2002cfbad4305fb1bc541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andri=20=C3=93skarsson?= Date: Sun, 10 May 2026 15:02:31 +0200 Subject: [PATCH] fix(examples/gastro): use `go tool gastro` in //go:generate CI failed on the post-migration drift gate with: generate.go:22: running "gastro": exec: "gastro": executable file not found in $PATH The mise-action adds the standalone tailwindcss binary to PATH but doesn't install `gastro` (it's not declared in mise.toml \u2014 the website is self-hosting). The example's go.mod already declares `tool github.com/andrioid/gastro/cmd/gastro`, so switching the directive to `go tool gastro generate` resolves the binary through the tool directive and works in CI without any extra setup. Local mise-activated shells continue to work because `go tool` is a strict superset of having `gastro` on PATH. Also corrects the matching reference in docs/contributing.md. --- docs/contributing.md | 4 ++-- examples/gastro/generate.go | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index e2d222d..f897c29 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -66,8 +66,8 @@ go generate ./... ``` The `//go:generate` directives in `examples/gastro/generate.go` invoke -`tailwindcss` followed by `gastro generate`. CI runs the same command -and fails if the result differs from what's committed. +`tailwindcss` followed by `go tool gastro generate`. CI runs the same +command and fails if the result differs from what's committed. For a hot-reload dev loop that rebuilds CSS, regenerates the gastro tree, and restarts the binary on every change: diff --git a/examples/gastro/generate.go b/examples/gastro/generate.go index 9fce001..8c953f1 100644 --- a/examples/gastro/generate.go +++ b/examples/gastro/generate.go @@ -5,20 +5,23 @@ // 1. Compile Tailwind CSS source (tailwind.css) into the embedded // stylesheet at static/styles.css. Output is minified for parity // with what ships in the binary. -// 2. Run `gastro generate` to regenerate the .gastro/ package tree -// against any .gastro template changes. +// 2. Run `go tool gastro generate` to regenerate the .gastro/ package +// tree against any .gastro template changes. The `go tool gastro` +// form resolves through the `tool` directive in go.mod, so we +// don't need a `gastro` binary on PATH (CI has the mise-managed +// tailwindcss binary on PATH but doesn't separately install +// gastro — the tool directive covers that case). // // `go generate` runs directives top-to-bottom within a single file, so // the freshly-built CSS is on disk before gastro generate's //go:embed // snapshot of static/ is taken. // -// Both commands must be on PATH. mise satisfies this once contributors -// run `mise install` from the repo root (see mise.toml). -// // CI gate: `go generate ./... && git diff --exit-code` from this -// directory catches drift in either the CSS or the .gastro/ tree. +// directory catches Tailwind CSS drift. The .gastro/ tree is +// gitignored, so codegen drift is covered separately by `gastro check` +// where it runs. //go:generate tailwindcss -i tailwind.css -o static/styles.css --minify -//go:generate gastro generate +//go:generate go tool gastro generate package main -- 2.51.2