Uh oh!
There was an error while loading. Please reload this page.
Detect typed map[string]bool set aliases in short declarations - #51303
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Great work! 🎉 This fix to the The change is well-scoped — removing the redundant RHS AST-shape check and relying solely on the type system to identify eligible The simplification from 38 deleted lines and 2 added lines shows this was a clean fix that removed unnecessary complexity rather than adding new logic. The diff balances well with the test expansion. This PR looks ready for review. Nice work aligning the
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Updates seenmapbool to detect typed map[string]bool values initialized from helpers or variables.
Changes:
- Uses identifier types instead of RHS syntax for candidate detection.
- Removes obsolete AST-shape helpers.
- Adds regression cases for helper returns and map copies.
Show a summary per file
| File | Description |
|---|---|
pkg/linters/seenmapbool/seenmapbool.go | Broadens short-declaration candidate detection. |
pkg/linters/seenmapbool/testdata/src/seenmapbool/seenmapbool.go | Adds regression coverage for newly detected patterns. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
| continue | ||
| } | ||
| if isMapStringBool(pass.TypesInfo.TypeOf(ident)) && isMapStringBoolExpr(stmt.Rhs[i]) { | ||
| if isMapStringBool(pass.TypesInfo.TypeOf(ident)) { |
🎉 This pull request is included in a new release. Release: |
seenmapboolonly considered:=declarations when the RHS was a literalmake(map[string]bool)or composite literal. Typed maps returned by helpers or copied from variables were silently skipped.Candidate detection
:=eligibility check.Regression coverage
map[string]boolparameters.:=candidate gate requires literal make()/composite RHS, causing false negatives for map[string]bool sets built a [Content truncated due to length] #51300