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
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 · ◷
Problem
Four registered analyzers in
pkg/linters/registry.go(64 total, verified viagrep -c '.Analyzer,') are correctly implemented, type/AST-resolved,nolint-wired, andfilecheck-wired (test/generated-file skip), but are not in the CI enforcement gate in.github/workflows/cgo.yml(LINTER_FLAGSon the-test=falseproduction-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 owntestdata/fixtures trigger them.Locations
pkg/linters/globwalkignorederror/globwalkignorederror.go— flagsfilepath.Glob/os.ReadDircalls whose error is discarded with_. Resolves the callee viapass.TypesInfo.Uses[ident].(*types.PkgName).Imported().Path()(not syntactic package-name matching), so it's immune to thesyntactic_stdlib_matchclass of bug seen in older linters (Linter precision (regression): the syntactic stdlib-package-match migration never landed — 5 holdouts remain, 3 CI-enforced (#40 [Content truncated due to length] #43934). This is the newest of the four (added in [linter-miner] Add globwalkignorederror linter: flag discarded errors from filepath.Glob/os.ReadDir #51149/Add globwalkignorederror linter: flag discarded errors from filepath.Glob/os.ReadDir #51185) and has never been audited or enforced.grep -rn "filepath.Glob\|os.ReadDir" --include="*.go" pkg internal cmd | grep -v _test.go | grep ", _"→ only matches insideglobwalkignorederror/testdata/.pkg/linters/appendbytestring/appendbytestring.go— flagsappend(b, []byte(s)...).grep -rn "append(.*\[\]byte(" --include="*.go" pkg cmd internal | grep -v _test.go→ only matches insideappendbytestring/testdata/.pkg/linters/sortslice/sortslice.go— flagssort.Slice/sort.SliceStablein favor ofslices.SortFunc/slices.SortStableFunc.grep -rn "sort\.Slice(\|sort\.SliceStable(" --include="*.go" pkg cmd internal | grep -v _test.go→ only matches insidesortslice/testdata/.pkg/linters/deferinloop/deferinloop.go— flagsdeferplaced directly insidefor/rangebodies (correctly stops atFuncLit/go funcboundaries — this is the reference-correct implementation other linters' scope-walks have been compared against).defergrep around loop bodies acrosspkg,cmd,internal→ only matches insidedeferinloop/testdata/.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-scopeddeferleaks) 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 -deferinloopto theLINTER_FLAGSvalue(s) in.github/workflows/cgo.yml(both the native production-code job at line ~1370 and, where applicable, theGOOS=js GOARCH=wasmjob at line ~1373 — check each analyzer's build-tag applicability togh-aw-wasmfirst, per the known blind-spot class from #42645).Validation checklist
make golint-custom LINTER_FLAGS="-globwalkignorederror -appendbytestring -sortslice -deferinloop -test=false"locally/in CI and confirm zero findings before merging the gate change.-changed-files-style flag (they don't today — verified viainit()/Flagsgrep) that would make blanket full-repo enforcement inappropriate, unlikeerrormessage(which is intentionally diff-scoped and enforced via the separate.github/workflows/error-message-lint.yml, notcgo.yml).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), anderrormessage/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).