Skip to content

Enforce-readiness: 4 clean, type-resolved linters have zero production violations — uncheckedflushreturn, bytescomparestring, ni [Content truncated due to length] #50178

Description

@github-actions

Summary

Registry has grown from 43 to 62 analyzers since the last audited baseline (R60), but CI (.github/workflows/cgo.yml, lint-go job, LINTER_FLAGS) only enforces 39. Of the 23 unenforced linters, these 4 are fully wired (type-resolved detection, internal/nolint + internal/filecheck support), have their previously-filed correctness bugs already fixed in code, and have zero production violations under the default build — the standard bar this repo uses before flipping a linter on in CI (matching prior batched issues #45629, #47916, #49710).

Evidence per linter

uncheckedflushreturn (62nd/newest linter) — click to expand
  • pkg/linters/uncheckedflushreturn/uncheckedflushreturn.go
  • Node filter covers ExprStmt, AssignStmt, and DeferStmt (the DeferStmt gap from the prior issue is fixed — checkDiscardedFlushDefer at line 106).
  • Type-resolved: verifies the callee is named Flush, takes no args, and returns exactly one value satisfying the error interface (isFlushCallReturningError, lines 127-148).
  • nolint/filecheck wired and exercised in tests (testdata/.../uncheckedflushreturn.go:27,57).
  • Zero production violations: repo-wide grep for .Flush() outside tests/testdata finds only 2 call sites (pkg/cli/logs_format_compact.go:140,322), both already check the returned error.
bytescomparestring — click to expand
nilctxpassed — click to expand
stringbytesroundtrip — click to expand

Recommendation

Add all 4 flags to both LINTER_FLAGS invocations in .github/workflows/cgo.yml (lint-go job, "Run custom linters" and "Run custom linters (wasm)" steps):

-uncheckedflushreturn -bytescomparestring -nilctxpassed -stringbytesroundtrip

Validation checklist

  • Confirm make golint-custom LINTER_FLAGS="...new flags... -test=false" passes clean on main for both the default and GOOS=js GOARCH=wasm builds
  • Add the 4 flags to both LINTER_FLAGS strings in .github/workflows/cgo.yml
  • Re-run CI once to confirm no unexpected violations surface under the wasm-specific package subset (./pkg/console ./pkg/parser ./pkg/styles ./pkg/tty ./pkg/workflow)

Effort

Small — no source changes required, only a CI config edit plus a verification run.

Generated by 🤖 Sergo - Serena Go Expert · agent · 234 AIC · ⌖ 31.8 AIC · ⊞ 6K ·

  • expires on Aug 10, 2026, 9:03 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