Repository navigation
Description
Problem
.github/workflows/cgo.yml runs the custom Go linter suite twice: once natively (line 1499) and once for GOOS=js GOARCH=wasm (line 1523, scoped to LINTER_PACKAGES="./pkg/console ./pkg/parser ./pkg/styles ./pkg/tty ./pkg/workflow"). The two LINTER_FLAGS strings are flag-for-flag identical except -contextcancelnotdeferred, which appears only in the native line.
This is a reverse-phantom
This exact gap was already filed as #55932 (temporary_id sg61a1) on 2026-08-26 and auto-expired closed not_planned on 2026-09-02 without ever being fixed. Re-reading the current cgo.yml (5+ weeks and dozens of edits later) confirms the gap is still 100 percent present at lines 1499/1523 today.
Root cause
Git history shows the omission was introduced in PR #49783 (enforce: add contextcancelnotdeferred and wgdonenotdeferred to CI linter gates, 2026-08-02). That PR added both new linters to the native LINTER_FLAGS list, but only added wgdonenotdeferred (not contextcancelnotdeferred) to the wasm list - a copy-paste gap at the moment the linter was introduced, confirmed via the commit diff.
Why the drift guard does not catch it
pkg/linters/doc_sync_test.go TestCIEnforcedLintersMatchRegistry (added by #55636 specifically to guard registry-to-CI drift) reads cgo.yml, regex-matches both LINTER_FLAGS="..." occurrences, then unions every flag from both matches into one shared enforced map before checking membership against linters.All(). Because the check is a union rather than a per-target comparison, an analyzer enforced on only one of the two targets still satisfies enforcedInCI and the test passes - the native/wasm asymmetry is structurally invisible to the very guard meant to prevent this class of drift.
Impact
Currently latent: grepping all *_wasm.go files under the 5 wasm-linted packages (pkg/console, pkg/parser, pkg/styles, pkg/tty, pkg/workflow) found zero context.WithCancel/WithTimeout/WithDeadline call sites today. But any future wasm-build-tagged file using a cancellable context and manually closing it instead of deferring cancel() will pass CI silently, since neither lint pass checks it (native cannot see _wasm.go files due to build constraints; wasm does not enforce this analyzer).
Recommendation
- Add -contextcancelnotdeferred to the wasm LINTER_FLAGS string in cgo.yml so both targets stay in lockstep.
- Harden TestCIEnforcedLintersMatchRegistry to assert the native and wasm flag sets are identical (modulo -test=false and the wasm-only LINTER_PACKAGES argument) instead of only their union, so this exact class of drift cannot silently reappear for this or any future analyzer.
Validation checklist
- -contextcancelnotdeferred added to wasm LINTER_FLAGS in cgo.yml
- doc_sync_test.go gains a native-vs-wasm flag-set equality assertion
- wasm golint-custom target run locally/in CI to confirm no new violations surface
Effort
Small - a one-line workflow edit plus a focused test addition.
Generated by 🤖 Sergo - Serena Go Expert · claude · agent · 271 AIC · ⌖ 7.23 AIC · ⊞ 5.2K · ◷
- expires on Oct 11, 2026, 8:11 PM UTC-08:00
Activity
pelikhan commentedon Oct 11, 2026
Reviewed against completed essentials issue #67451 (#67451) and merged PR #67544 (#67544).
Keeping this issue open: The WASM CI LINTER_FLAGS still omit -contextcancelnotdeferred, and #67544 does not change cgo.yml or the CI parity test. The specific acceptance criteria here remain unmet.
github-actions commentedon Oct 12, 2026
This issue was automatically closed because it expired on 2026-10-12T04:11:34.724Z.