Skip to content

ci: add a go job with build, test, gofmt and golangci-lint - #78

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/ci-golangci-lint
Aug 30, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/ci-golangci-lint

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Second instance of the go-ci-lint-parity batch (opencharly/charly#464), after opencharly/charly#486.

This repo had no Go CI at all — only pr-validator.yml and tag-on-merge.yml, neither of which builds, tests or lints the module. The only enforcement was the local .claude/hooks/pre-commit-gate.sh, so nothing kept main green between commits.

Adds a go job: build, test, gofmt, golangci-lint.

The drift is real, and it recurs

charly#464 measured 11 findings on this repo's main on 2026-08-29. #68 cleared them. main has 2 again today, introduced by #73:

lock/filelock_timeout_test.go:25:15: Error return value of `f.Close` is not checked (errcheck)
lock/filelock_timeout_test.go:30:15: Error return value is not checked (errcheck)

That is the whole argument for the gate, observed twice in two days on one repo. And the cost does not land on whoever caused it: because the hook lints the whole repo rather than the diff, these two findings would have blocked the next contributor to touch this repo — someone with no connection to #73.

Both are deferred calls in a test whose errors were never meant to be consumed. They are made explicit (defer func() { _ = f.Close() }()) rather than silenced with a nolint, so the gate lands green on a tree that is genuinely clean.

How tested

The exact commands the job runs, against this tree:

$ go build ./...
build exit=0

$ go test ./...
packages ok: 18        (no failures)

$ gofmt -l .
gofmt: clean

$ golangci-lint run ./...
0 issues.

Before the two-line fix that same lint run reported:

2 issues:
* errcheck: 2

and go test ./lock/ still passes after it:

ok  	github.com/opencharly/spec/lock	0.203s

Workflow parses:

$ python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))"
workflow YAML parses

The job's own run on this PR is the live proof it executes and passes.

Two deliberate choices

Pinned by module version, not a third-party action. go install github.com/golangci/golangci-lint/v2/cmd/[email protected] makes the CI binary the same build the pre-commit hook uses locally. A gate that disagrees with the hook is worse than no gate: it fails people who did everything right. It also means a new upstream release cannot turn main red on its own schedule.

build + test + gofmt alongside the lint, because this repo had none of them in CI — adding only the lint step would leave a module whose tests nothing runs.

Rulebook compliance

  • R1 (RCA) — the gap and its consequence are measured (no Go CI here; 11 findings then, 2 now, both times on a pristine main), not asserted.
  • R2 (no deferral) — the 2 findings the gate exposed are fixed in this PR, not filed for someone else; landing a gate that turns main red would be exactly the split R2 forbids.
  • R3 (no duplication) — uses the repo's existing .golangci.yml; no parallel lint configuration.
  • R4 (no workarounds) — the deferred errors are explicitly discarded at the call, not suppressed with a nolint directive or an exclusion rule.
  • R6 (git safety) — feature branch, no force-push, no hook bypass.
  • R7 (prove the gate) — every command the job runs is pasted above with its output, before and after the fix.

Change classification

  • Change class: CI configuration (new workflow) + a two-line test fix it exposed
  • Verification gate: build, full test suite, gofmt and golangci-lint executed locally on the committed tree, plus the job running on this PR
  • Attribution tier: fully tested and validated — the gate was run before and after the fix it required, and the suite passes against the committed tree

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

This repo had NO Go CI: only pr-validator.yml and tag-on-merge.yml, neither of
which builds, tests or lints the module. The only enforcement was the local
pre-commit hook, so nothing kept main green between commits.

The drift is not hypothetical, and it recurs. opencharly/charly#464 measured 11
findings on this repo's main on 2026-08-29; #68 cleared them; main has 2 again
today, from #73:

    lock/filelock_timeout_test.go:25:15: Error return value of `f.Close` is not checked
    lock/filelock_timeout_test.go:30:15: Error return value is not checked

Both are deferred calls in a test whose errors were never meant to be consumed;
they are made explicit rather than silenced, so the gate lands green.

That recurrence is the argument for the gate. Because the hook lints the WHOLE
repo rather than the diff, these two findings would have blocked the next
contributor to touch this repo — someone with no connection to #73.

golangci-lint is pinned by module version rather than a third-party action, so
the CI binary is the same build the hook uses locally and a new upstream release
cannot turn main red on its own schedule.

Second instance of the go-ci-lint-parity batch, after opencharly/charly#486.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: ef55c27f2735 (branch: ci/go-job)

Security screen: PASS — new CI workflow adds build/test/gofmt/golangci-lint gates (strengthening, not weakening); permissions: contents: read least-privilege; pinned [email protected]; standard actions/checkout@v5/setup-go@v5; no secrets, egress, or scope mismatch. The two-line test fix matches the description exactly.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3: body accounts for both diff items (workflow + test fix), pastes real output for every command the job runs (build/test/gofmt/lint, before and after the fix), names the go-ci-lint-parity batch (charly#464), and the fully tested and validated tier is justified — the changed test path executed live via go test ./lock/ and the full suite. Footer in exact *Assisted-by:* form.
  • R1: measured RCA (11 findings then, 2 now, both on pristine main, attributed to fix(lock): bound the blocking acquire — fail fast on a contended flock #73), no forbidden framing.
  • R2: the 2 exposed findings are fixed in-tree, not deferred.
  • R3: reuses existing .golangci.yml, no parallel config.
  • R4: deferred errors explicitly discarded, not nolint'd.
  • R6: feature branch, no force-push, no hook bypass.
  • R10: exact commands pasted with internally consistent output; diff aligns with the claimed 2 errcheck findings at lock/filelock_timeout_test.go:25 and :30.
  • B16 placement: CORRECT — CI at .github/workflows/, test fix in the lock package; no core/sdk/candy misplacement.
  • B18: gofmt-clean, no lint-visible issues in the diff.
  • No comments on the thread to adjudicate.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 11:13
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: dcb5d146d729 (branch: ci/go-job)

Security screen: PASS — new CI workflow adds build/test/gofmt/golangci-lint gates (strengthening, not weakening); permissions: contents: read least-privilege; pinned [email protected]; standard actions/checkout@v5/setup-go@v5; no secrets, egress, or scope mismatch. The two-line test fix matches the description exactly.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3: body accounts for both diff items (workflow + test fix), pastes real output for every command the job runs (build/test/gofmt/lint, before and after the fix), names the go-ci-lint-parity batch (charly#464), and fully tested and validated is justified — the changed test path executed live via go test ./lock/ and the full suite. Footer in exact *Assisted-by:* form.
  • R1: measured RCA (11 findings on 2026-08-29, 2 today attributed to fix(lock): bound the blocking acquire — fail fast on a contended flock #73, both on pristine main), no forbidden framing.
  • R2: the 2 exposed findings are fixed in-tree, not deferred.
  • R3: reuses existing .golangci.yml, no parallel config.
  • R4: deferred errors explicitly discarded at the call, not nolint'd.
  • R6: feature branch, no force-push, no hook bypass.
  • R10: exact commands pasted with internally consistent output; diff aligns with the claimed 2 errcheck findings at lock/filelock_timeout_test.go:25 and :30.
  • B16 placement: CORRECT — CI at .github/workflows/, test fix in the lock package; no core/sdk/candy misplacement.
  • B18: gofmt-clean, no lint-visible issues in the diff.
  • Comment intake: the single prior github-actions[bot] PASS (at head ef55c27f2735) is consistent with the current state — the merge commit brought in main without changing the diff; disposition verified-non-blocking.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot merged commit f8b6e3a into main Aug 30, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 30, 2026
…mage (#83)

main is red. #82 split ResolveLocalImage into a gather and an election, and the
election kept a shortName parameter it never reads — the name filtering all
happens in gatherResolverCandidates, before election.

    container/local_image_coneb.go:505:82: electResolvedImage - shortName is
    unused (unparam)

Caught by the golangci-lint gate added in #78, one commit after it landed, on
its own author. That is the gate working exactly as intended: without it this
would have sat on main until it blocked whoever touched this repo next, because
the pre-commit hook lints the WHOLE repo rather than the diff.

I ran `go build ./container/`, `go vet ./container/` and `go test ./container/`
before #82 but not `golangci-lint run ./...` — the one check that would have
seen it.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6

Co-authored-by: atrawog <[email protected]>
@aitrawog
aitrawog deleted the feat/ci-golangci-lint branch September 25, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant