Template ships a non-green baseline: missing go.sum + two errcheck lint bugs #2

Closed
opened 2026-07-04 10:42:30 +00:00 by mathias · 1 comment
Owner

Problem

A repo generated from template-go-agent does not pass task check out of the box, even after correct placeholder substitution. Two template-level defects break the baseline:

  1. No go.sum shipped. The template root has go.mod but no go.sum, so go build ./... fails on missing sum entries until someone runs go mod tidy. Verified: the template root currently ships no go.sum file.
  2. Two errcheck lint failures in the template's own code — an unchecked deferred shutdown(ctx) and an unchecked resp.Body.Close(). golangci-lint (v2.x, as configured in CI) fails on both.

Evidence

Surfaced while bootstrapping mathias/parallax (generated from this template). koala Claude had to fix all three items by hand to get a green baseline — see parallax#1 and commit 5dce341 in that repo. Because these are defects in the template source, every repo generated from template-go-agent inherits them.

Desired outcome

A freshly generated repo passes task check immediately after substitution, with no manual fix-ups.

Suggested fixes (technique TBD in this repo)

  • Commit a go.sum (run go mod tidy and check it in), or add a CI/generation step that guarantees it.
  • Fix the two errcheck sites: check the errors on the deferred shutdown(ctx) and resp.Body.Close() (e.g. _ = f() if intentionally ignored, or proper handling/logging).
  • Confirm go build ./... and task check are green on a clean checkout before closing.

Notes

  • This template is not dispatch-eligible yet, so this is a manual/local task (run on koala), not a dispatch job.
  • Independent of the gitea-mcp substitution/durability issues (filed separately) — this is purely a template-content fix and can land on its own.
## Problem A repo generated from `template-go-agent` does **not** pass `task check` out of the box, even after correct placeholder substitution. Two template-level defects break the baseline: 1. **No `go.sum` shipped.** The template root has `go.mod` but no `go.sum`, so `go build ./...` fails on missing sum entries until someone runs `go mod tidy`. Verified: the template root currently ships no `go.sum` file. 2. **Two `errcheck` lint failures in the template's own code** — an unchecked deferred `shutdown(ctx)` and an unchecked `resp.Body.Close()`. `golangci-lint` (v2.x, as configured in CI) fails on both. ## Evidence Surfaced while bootstrapping `mathias/parallax` (generated from this template). koala Claude had to fix all three items by hand to get a green baseline — see parallax#1 and commit `5dce341` in that repo. Because these are defects in the template *source*, every repo generated from `template-go-agent` inherits them. ## Desired outcome A freshly generated repo passes `task check` immediately after substitution, with no manual fix-ups. ## Suggested fixes (technique TBD in this repo) - Commit a `go.sum` (run `go mod tidy` and check it in), or add a CI/generation step that guarantees it. - Fix the two `errcheck` sites: check the errors on the deferred `shutdown(ctx)` and `resp.Body.Close()` (e.g. `_ = f()` if intentionally ignored, or proper handling/logging). - Confirm `go build ./...` and `task check` are green on a clean checkout before closing. ## Notes - This template is **not dispatch-eligible yet**, so this is a manual/local task (run on koala), not a dispatch job. - Independent of the gitea-mcp substitution/durability issues (filed separately) — this is purely a template-content fix and can land on its own.
mathias added the risk/lowsize/stype/fix labels 2026-08-27 05:25:47 +00:00
Author
Owner

Fixed in 2b3851a (v0.1.0), verified 2026-09-17 — same commit as #1, which is the same defect seen from a second bootstrap. Full write-up is on #1; this records what is specific to this issue.

Two of the three defects listed here were already fixed, and this issue did not know.

Listed here State on 2026-09-17
No go.sum shipped already present — go build ./... exits 0 on a clean checkout
resp.Body.Close() unchecked already wrapped — pkg/litellm/model.go:115 reads defer func() { _ = resp.Body.Close() }()
deferred shutdown(ctx) unchecked still live — this is what 2b3851a fixes

Verified before touching anything, rather than trusted from the issue text. Working from the description would have meant "fixing" a go.sum that exists and a Close() already wrapped, then reporting three fixes where there was one.

Why it survived two independent reports

Both this issue and #1 correctly identified the symptom and neither could explain why the template itself stayed green. The answer is that Go skips directories whose names start with an underscore when expanding ./..., so cmd/__PROJECT_NAME__ was never analysed here — while in mathias/parallax and mathias/brain-gardener, where the directory has a real name, it was.

Two reporters, two repos, same invisible cause. That is the signature of a defect in the transformation rather than in either artifact.

What stops the recurrence

scripts/tests/generated-child_test.sh in task check now substitutes the tracked tree into a throwaway child and gates go list / build / vet / golangci-lint on the result. Your closing line asked to "confirm go build ./... and task check are green on a clean checkout before closing" — that is now a gate rather than a one-time confirmation, and it caught the entrypoint invisibility as its first assertion.

Confirmed running in CI (run 7509), not merely present: 4 passed, 0 failed.


Created via git-mcp on behalf of @mathias

**Fixed in `2b3851a` (v0.1.0), verified 2026-09-17** — same commit as #1, which is the same defect seen from a second bootstrap. Full write-up is on #1; this records what is specific to this issue. **Two of the three defects listed here were already fixed, and this issue did not know.** | Listed here | State on 2026-09-17 | |---|---| | No `go.sum` shipped | **already present** — `go build ./...` exits 0 on a clean checkout | | `resp.Body.Close()` unchecked | **already wrapped** — `pkg/litellm/model.go:115` reads `defer func() { _ = resp.Body.Close() }()` | | deferred `shutdown(ctx)` unchecked | **still live** — this is what `2b3851a` fixes | Verified before touching anything, rather than trusted from the issue text. Working from the description would have meant "fixing" a `go.sum` that exists and a `Close()` already wrapped, then reporting three fixes where there was one. ## Why it survived two independent reports Both this issue and #1 correctly identified the symptom and neither could explain why the template itself stayed green. The answer is that **Go skips directories whose names start with an underscore** when expanding `./...`, so `cmd/__PROJECT_NAME__` was never analysed here — while in `mathias/parallax` and `mathias/brain-gardener`, where the directory has a real name, it was. Two reporters, two repos, same invisible cause. That is the signature of a defect in the *transformation* rather than in either artifact. ## What stops the recurrence `scripts/tests/generated-child_test.sh` in `task check` now substitutes the tracked tree into a throwaway child and gates `go list` / `build` / `vet` / `golangci-lint` on the result. Your closing line asked to *"confirm `go build ./...` and `task check` are green on a clean checkout before closing"* — that is now a gate rather than a one-time confirmation, and it caught the entrypoint invisibility as its first assertion. Confirmed running in CI (run 7509), not merely present: `4 passed, 0 failed`. --- _Created via git-mcp on behalf of @mathias_
Sign in to join this conversation.