diff --git a/.gitea/workflows/cd.yml b/.gitea/workflows/cd.yml index 36e35b4..9af640c 100644 --- a/.gitea/workflows/cd.yml +++ b/.gitea/workflows/cd.yml @@ -48,7 +48,14 @@ jobs: - name: Install toolchain run: | go version - go install github.com/a-h/templ/cmd/templ@latest + # Pin the GENERATOR to the same version as the templ LIBRARY in + # go.mod. Installing @latest let them drift: the generator emitted + # calls (templruntime.WriteString) that the pinned library did not + # have, which is template-go-web#8. Nothing caught it because the + # guard skipped `check` in this repo entirely (#12). + templ_version="$(go list -m -f '{{.Version}}' github.com/a-h/templ)" + echo "templ library is $templ_version — installing the matching generator" + go install "github.com/a-h/templ/cmd/templ@$templ_version" curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh \ | sh -s -- -b "$(go env GOPATH)/bin" v2.11.4 diff --git a/.gitignore b/.gitignore index 902b7e7..756de3f 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ go.work.sum # Project-specific bin/ -*.templ.go +# templ writes _templ.go -- this was '*.templ.go' (a dot, not an +# underscore) and therefore matched nothing, so generated files were only ever +# kept out of git by luck. template-go-web#8. +*_templ.go diff --git a/go.mod b/go.mod index 198b4ef..131d2d2 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,4 @@ module __MODULE_PATH__ go 1.26 -require ( - github.com/a-h/templ v0.2.778 -) +require github.com/a-h/templ v0.3.1020 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..0857b6f --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +github.com/a-h/templ v0.3.1020 h1:ypAT/L5ySWEnZ6Zft/5yfoWXYYkhFNvEFOeeqecg4tw= +github.com/a-h/templ v0.3.1020/go.mod h1:A2DlK61v+K+NRoGnhmYbNYVmtYHcFO5/AisMvBdDxTM= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=