Skip to content

globwalkignorederror + strconvparseignorederror: AssignStmt-only filter still misses bare ExprStmt discards (9th reverse-phantom #63094

Description

@github-actions

Summary

Issue #61265 (sg68a1) was auto-expired closed/not_planned on 2026-09-23, but the underlying bug is 100% unfixed. This is the 9th confirmed reverse-phantom-reconcile instance in this repo (closed-without-fix), and the 2nd time this exact bug lineage has been refiled after auto-expiry.

The bug

Both linters only register a single-node filter for *ast.AssignStmt:

// pkg/linters/globwalkignorederror/globwalkignorederror.go:33
nodeFilter := []ast.Node{(*ast.AssignStmt)(nil)}

// pkg/linters/strconvparseignorederror/strconvparseignorederror.go:35
nodeFilter := []ast.Node{(*ast.AssignStmt)(nil)}

Each analyzer function then requires len(assign.Lhs) == 2 with a blank second operand (_, _ = filepath.Glob(pattern) / _, _ = strconv.Atoi(s)). Neither has any *ast.ExprStmt branch, so a bare statement that drops both return values entirely, for example:

os.ReadDir(dir)      // legal Go, error silently dropped, invisible to globwalkignorederror
strconv.Atoi(input)  // legal Go, error silently dropped, invisible to strconvparseignorederror

is never reached by either linter, despite matching the exact motivating pattern (a discarded parse/glob/readdir error) each linter exists to catch. Both linters are CI-enforced (native+wasm, cgo.yml LINTER_FLAGS).

Why this keeps recurring

The sibling linter jsonmarshalignoredeerror hit the identical gap and was fixed via a dedicated checkDiscardedJSONExpr ExprStmt branch (tracked in this repos node_filter_too_narrow pattern history). That fix was never ported to these two siblings. Re-reading the current source confirms zero change since the original filing: still exactly one nodeFilter entry, still zero ExprStmt handling, and the testdata fixtures for both linters cover only the two-value blank-assignment shape.

Recommendation

Add an *ast.ExprStmt branch to each analyzers run, mirroring checkDiscardedJSONExprs approach: match a bare *ast.CallExpr to the tracked function, confirm via pass.TypesInfo that it resolves to path/filepath.Glob, os.ReadDir, or the relevant strconv parse function, and report the same diagnostic used for the two-value form. Add one ExprStmt test case per linter alongside the existing AssignStmt cases.

Validation checklist

  • os.ReadDir(dir) as a bare statement is flagged by globwalkignorederror
  • filepath.Glob(pattern) as a bare statement is flagged by globwalkignorederror
  • strconv.Atoi(s) (and siblings ParseInt/ParseFloat/ParseBool/ParseUint) as a bare statement is flagged by strconvparseignorederror
  • existing AssignStmt-based test cases still pass unchanged

Effort: small, isolated to two files plus their testdata.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by 🤖 Sergo - Serena Go Expert · claude · agent · 247.5 AIC · ⌖ 8.38 AIC · ⊞ 7K · ◷

  • expires on Sep 30, 2026, 7:58 PM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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