Repository navigation
Close recurring Go linter analyzer blind spots - #67544
Merged
pelikhan merged 2 commits intoOct 11, 2026
Merged
Conversation
2 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix recurring Go linter analyzer blind spots and improve coverage
Close recurring Go linter analyzer blind spots
Oct 11, 2026
pelikhan
marked this pull request as ready for review
October 11, 2026 00:57
pelikhan
deleted the
copilot/aw-top-10-close-recurring-go-linter-analyzer-blind
branch
October 11, 2026 00:58
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The range-over-function exemption contradicts Go defer semantics, while alias resolution can misclassify mutable aliases.
4 open findings
What changed in this PR
This PR addresses Go analyzer blind spots in call matching, coverage gating, and loop detection.
Changes:
- Adds function-alias and bare discarded-call matching.
- Makes coverage lookup column-aware and deterministic.
- Adds special handling for range-over-function loops.
| File | Description |
|---|---|
pkg/linters/internal/astutil/astutil.go |
Extends shared call matching and alias resolution. |
pkg/linters/internal/coverage/coverage.go |
Improves coverage block and filename selection. |
pkg/linters/internal/coverage/coverage_test.go |
Tests column and path specificity. |
pkg/linters/deferinloop/deferinloop.go |
Changes range-over-function handling. |
pkg/linters/deferinloop/testdata/src/deferinloop/deferinloop.go |
Adds iterator-loop fixture. |
pkg/linters/globwalkignorederror/globwalkignorederror.go |
Detects bare discarded calls. |
pkg/linters/globwalkignorederror/testdata/src/globwalkignorederror/globwalkignorederror.go |
Adds bare-call fixtures. |
pkg/linters/jsonmarshalignoredeerror/jsonmarshalignoredeerror.go |
Reuses shared discarded-call matching. |
pkg/linters/reflect-deepequal-usage/testdata/src/a/a.go |
Enables alias detection assertion. |
pkg/linters/strconvparseignorederror/strconvparseignorederror.go |
Detects bare discarded parse calls. |
pkg/linters/strconvparseignorederror/testdata/src/strconvparseignorederror/strconvparseignorederror.go |
Adds bare-call fixture. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+77
to
+80
| if pass.TypesInfo != nil { | ||
| if typ := pass.TypesInfo.TypeOf(node.X); typ != nil { | ||
| if _, ok := typ.Underlying().(*types.Signature); ok { | ||
| return false |
| blank, ok := secondLHS.(*ast.Ident) | ||
| if !ok || blank.Name != "_" { | ||
| case *ast.ExprStmt: | ||
| call, ok = stmt.X.(*ast.CallExpr) |
Comment on lines
+125
to
+129
| func packageFunctionAlias(pass *analysis.Pass, obj types.Object, seen map[types.Object]bool) (string, string, bool) { | ||
| if obj == nil { | ||
| return "", "", false | ||
| } | ||
| pkgName, ok := pass.TypesInfo.Uses[ident].(*types.PkgName) | ||
| if !ok || pkgName.Imported() == nil { | ||
| if seen == nil { |
Comment on lines
+150
to
+154
| value := packageFunctionAliasInitializer(pass, node, obj) | ||
| if value == nil { | ||
| return true | ||
| } | ||
| pkgPath, funcName, _ = packageFunction(pass, value, seen) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Several analyzers missed function aliases and bare discarded-error calls; coverage gating could select the wrong block or file, and
deferinloopmisreported range-over-function iterators.filepath.Glob,os.ReadDir, andstrconvparsing; reuse the matcher for JSON calls.