Skip to content

fix(linters): see through parens, aliases and dot-imports in osexitinlibrary, rawloginlib, logfatallibrary, fprintferrorunchecke - #76123

Merged
pelikhan merged 1 commit into
mainfrom
sergo/paren-unwrap-exit-log-fprint-r124-0d9f9976e192c413
Nov 9, 2026
Merged

pelikhan merged 1 commit into
mainfrom
sergo/paren-unwrap-exit-log-fprint-r124-0d9f9976e192c413

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Continues the Sergo "callee shape" audit (R120–R123 merged: #75085, #75294, #75295, #75599, #75816). Five more linters matched call.Fun with a bare *ast.SelectorExpr assertion or a literal identifier name instead of resolving the callee through the type checker.

Evidence and fixes

Linter Gap Fix
osexitinlibrary (os.Exit)(1) and dot-imported Exit(1) not reported use astutil.CalledOSFunc(pass, call, "Exit")
rawloginlib (log.Printf)(...), dot-imported Println(...) not reported use astutil.PackageCall (pkg log)
logfatallibrary (log.Fatal)(...), dot-imported Fatalln(...) not reported use astutil.PackageCall (pkg log)
fprintferrorunchecked package matched by the literal identifier fmt: import f "fmt" calls were missed, and a local named fmt with a Fprintf method returning (int, error) was false-flagged; also (fmt.Fprintf)(...), (fmt.Fprintf(...)) statements/RHS and (os.Stderr) console arguments new matchFprintCall helper (unwrap parens + PackageCall + fmt path); removed extractFunctionName; isConsoleOutput unwraps parens; the two duplicated assign patterns collapsed into one
blankassigncomma the hash.Hash io.WriteString exemption did not see through _, _ = (io.WriteString)(h, ...) / (io.WriteString(h, ...)), so these were false-flagged astutil.UnwrapParenExpr on RHS and Fun

PackageCall additionally resolves un-reassigned local function aliases, and is shadow-safe because it goes through TypesInfo.

Tests added (analysistest fixtures)

  • osexitinlibrary: parenthesized.go (incl. nested parens + nolint), dot_import.go
  • rawloginlib, logfatallibrary: parenthesized.go (parens, dot-import, nolint)
  • fprintferrorunchecked: parenthesized.go (parenthesized callee/call, aliased import, parenthesized console arg, nolint, shadowing fmt negative)
  • blankassigncomma: parenthesized hash exemption (negative) and parenthesized non-hash writer (positive)

Validation

  • Serena/gopls get_diagnostics_for_file on all 5 edited linter files and the new fixtures: no errors (only pre-existing unusedfunc hints on fixtures).
  • go test / gofmt / make were denied in this sandbox, so the analysistest suites were NOT executed here and make fmt was not run (comment alignment in the fixtures was done by hand). Please rely on CI (go test ./pkg/linters/...) and run make fmt if CI flags formatting.

🤖 Generated with [Claude Code]((claude.com/redacted)

Generated by 🤖 Sergo - Serena Go Expert · claude · routed: sonnet55 high · ~81 AIC · ⌖ ~2 AIC · ⊞ 4.7K · ◷

  • expires on Nov 15, 2026, 7:53 PM UTC-08:00

@github-actions github-actions Bot added cookie Issue Monster Loves Cookies! sergo labels Nov 9, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 04:26
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 04:26
@pelikhan
pelikhan merged commit 84a3ad8 into main Nov 9, 2026
13 checks passed
@pelikhan
pelikhan deleted the sergo/paren-unwrap-exit-log-fprint-r124-0d9f9976e192c413 branch November 9, 2026 04:26
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Specification Reviewer · gpt56 · ~1 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.7K · ◷

Generated by PR Specification Reviewer for #76123

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #76123

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported, although tests and formatting checks were not run and CI validation remains pending.

No open issues 🎉

What changed in this PR

Continues the linter call-matching improvements in gh-aw, making five analyzers handle equivalent Go syntax more consistently and reducing missed diagnostics and false positives.

Changes:

  • Uses shared, type-aware helpers to recognize parenthesized, dot-imported, and aliased calls in four linters.
  • Preserves the blankassigncomma hash-writing exemption for parenthesized calls.
  • Adds regression fixtures for alternate call forms, suppression directives, console output, and shadowed identifiers.

The PR reports that tests and formatting checks were not run; CI validation remains pending.

File Description
pkg/​linters/​rawloginlib/​testdata/​src/​rawloginlib/​parenthesized.go Tests parenthesized calls, dot imports, and suppression.
pkg/​linters/​rawloginlib/​rawloginlib.go Resolves logging calls with PackageCall.
pkg/​linters/​osexitinlibrary/​testdata/​src/​osexitinlibrary/​parenthesized.go Tests parenthesized exit calls and suppression.
pkg/​linters/​osexitinlibrary/​testdata/​src/​osexitinlibrary/​dot_import.go Tests dot-imported Exit.
pkg/​linters/​osexitinlibrary/​osexitinlibrary.go Matches exit calls with CalledOSFunc.
pkg/​linters/​logfatallibrary/​testdata/​src/​logfatallibrary/​parenthesized.go Tests parenthesized fatal calls, dot imports, and suppression.
pkg/​linters/​logfatallibrary/​logfatallibrary.go Resolves fatal logging calls with PackageCall.
pkg/​linters/​fprintferrorunchecked/​testdata/​src/​fprintferrorunchecked/​parenthesized.go Tests parentheses, import aliases, console exemptions, and shadowing.
pkg/​linters/​fprintferrorunchecked/​fprintferrorunchecked.go Adds type-aware call matching and consolidates blank-assignment handling.
pkg/​linters/​blankassigncomma/​testdata/​src/​blankassigncomma/​blankassigncomma.go Tests parenthesized hash and non-hash writer calls.
pkg/​linters/​blankassigncomma/​blankassigncomma.go Unwraps parentheses when checking the hash-writing exemption.

Review effort: Balanced (auto)

@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.2

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

Labels

cookie Issue Monster Loves Cookies! sergo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants