Skip to content

Enforce-readiness: 4 clean, type-resolved linters have zero production violations — globwalkignorederror, appendbytestring, sort [Content truncated due to length] #51679

Description

@github-actions

Problem

Four registered analyzers in pkg/linters/registry.go (64 total, verified via grep -c '.Analyzer,') are correctly implemented, type/AST-resolved, nolint-wired, and filecheck-wired (test/generated-file skip), but are not in the CI enforcement gate in .github/workflows/cgo.yml (LINTER_FLAGS on the -test=false production-only job, currently 46 flags / 42 unique linters). All four report zero violations against the current default-build production tree (pkg/, cmd/, internal/) — only their own testdata/ fixtures trigger them.

Locations

Impact

Without CI enforcement, a future contributor can reintroduce any of these four patterns (discarded glob/readdir errors, redundant byte-string appends, non-generic sort.Slice, loop-scoped defer leaks) with no automated signal, even though the codebase is currently 100% clean for all four. This is purely upside: adding them to the gate has zero remediation cost today and only prevents regressions.

Recommendation

Add -globwalkignorederror -appendbytestring -sortslice -deferinloop to the LINTER_FLAGS value(s) in .github/workflows/cgo.yml (both the native production-code job at line ~1370 and, where applicable, the GOOS=js GOARCH=wasm job at line ~1373 — check each analyzer's build-tag applicability to gh-aw-wasm first, per the known blind-spot class from #42645).

Validation checklist

  • Re-run make golint-custom LINTER_FLAGS="-globwalkignorederror -appendbytestring -sortslice -deferinloop -test=false" locally/in CI and confirm zero findings before merging the gate change.
  • Confirm none of the four analyzers has a -changed-files-style flag (they don't today — verified via init()/Flags grep) that would make blanket full-repo enforcement inappropriate, unlike errormessage (which is intentionally diff-scoped and enforced via the separate .github/workflows/error-message-lint.yml, not cgo.yml).
  • Spot-check the wasm build target for each of the four (GOOS=js GOARCH=wasm) since some stdlib calls (e.g. os.ReadDir) may be unused/absent there.

Estimated effort

Small — a config-only change to cgo.yml, no linter code changes required.

Non-goals (reviewed and excluded from this batch)

largefunc/excessivefuncparams (threshold linters with legitimate existing violations), hardcodedfilepath/httpstatuscode/httprespbodyclose/stringsconcatloop (each has a known, still-latent false-negative gap from a prior sergo issue blocking safe enforcement), and errormessage/ctxbackground/errorfwrapv/seenmapbool/lenstringzero/ssljson/sprintferrdot/regexpdynamicpattern (not verified clean this run — need a real build, which this sandbox couldn't perform, to confirm zero violations before adding).

Generated by 🤖 Sergo - Serena Go Expert · agent · 240.5 AIC · ⌖ 31.4 AIC · ⊞ 5.9K ·

  • expires on Aug 16, 2026, 8:28 PM UTC-08:00

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!sergo

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions