ci: enforce goroutinemissingrecover and trimleftright in lint gate - #49783
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Great work! 🎯 This PR looks ready to go. You've cleanly promoted two custom analyzers (
|
There was a problem hiding this comment.
Pull request overview
Promotes two custom Go analyzers into the CI lint gate.
Changes:
- Enforces
goroutinemissingrecoverandtrimleftright. - Applies both analyzers to default and WebAssembly lint jobs.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/cgo.yml |
Adds both analyzer flags to CI lint commands. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| # Note: -test=false intentionally scopes this gate to production code only. | ||
| - name: Run custom linters | ||
| run: make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -logfatallibrary -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -tolowerequalfold -httpnoctx -timeafterleak -errortypeassertion -execcommandwithoutcontext -sprintfint -stringsindexcontains -stringscountcontains -bytesbufferstring -ioutildeprecated -mapclearloop -mapdeletecheck -sprintfbool -appendoneelement -timenowsub -stringsjoinone -writebytestring -lenstringsplit -stringreplaceminusone -osgetenvlibrary -ossetenvlibrary -stringsindexhasprefix -contextcancelnotdeferred -wgdonenotdeferred -test=false" | ||
| run: make golint-custom LINTER_FLAGS="-errstringmatch -panicinlibrarycode -manualmutexunlock -osexitinlibrary -rawloginlib -logfatallibrary -regexpcompileinfunction -fprintlnsprintf -strconvparseignorederror -jsonmarshalignoredeerror -uncheckedtypeassertion -fmterrorfnoverbs -tolowerequalfold -httpnoctx -timeafterleak -errortypeassertion -execcommandwithoutcontext -sprintfint -stringsindexcontains -stringscountcontains -bytesbufferstring -ioutildeprecated -mapclearloop -mapdeletecheck -sprintfbool -appendoneelement -timenowsub -stringsjoinone -writebytestring -lenstringsplit -stringreplaceminusone -osgetenvlibrary -ossetenvlibrary -stringsindexhasprefix -contextcancelnotdeferred -wgdonenotdeferred -goroutinemissingrecover -trimleftright -test=false" |
Two custom analyzers verified clean against the full codebase are promoted from non-enforced to CI-gated.
Changes
.github/workflows/cgo.yml: Added-goroutinemissingrecoverand-trimleftrighttoLINTER_FLAGSin both the default-build gate and theGOOS=js GOARCH=wasmgate, following the same pattern as the previous enforce-readiness batch (appendoneelement,timenowsub,stringsjoinone).Analyzers
goroutinemissingrecover— flagsgo func() { ... }()bodies missing a top-leveldefer+recover()guard; uses type-resolved builtin detection to avoid false positives from shadowedrecoveridentifiers.trimleftright— flagsstrings.TrimLeft/TrimRightcalls with multi-character literal cutsets that look like accidentalTrimPrefix/TrimSuffixmisuse; single-rune and whitespace/separator character-class cutsets are correctly exempted.Zero violations found across all enforced packages (
./cmd/... ./pkg/...and the wasm subset).