Skip to content

fix(lint): resolve all errcheck findings (unblock CI Lint for v1.7.0)#216

Merged
UNC1739 merged 1 commit into
mainfrom
fix/errcheck-lint-v170
Jul 6, 2026
Merged

fix(lint): resolve all errcheck findings (unblock CI Lint for v1.7.0)#216
UNC1739 merged 1 commit into
mainfrom
fix/errcheck-lint-v170

Conversation

@UNC1739

@UNC1739 UNC1739 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes CI Lint green so we can cut v1.7.0. The dev→main merge (#214) surfaced errcheck failures (golangci-lint, check-type-assertions: true). This resolves all errcheck findings repo-wide.

Changes (errcheck only)

  • Discard intentional fmt.Fprint* writes to stdout / io.Writer with _, _ = (cmd_enum_github.go, cmd_enum_github_map.go, cmd_enum_google.go, cmd_enum_teams.go, progress.go, examples/enum-custom-demo/main.go)
  • Guard test-side type assertions with require.True(t, ok) (cmd_enum_lusha_test.go)
  • Check Close() returns (realframes_test.go, google_test.go)
  • Discard fmt.Fprint* writes to httptest response writers (github_test.go)

Verification

  • golangci-lint run --max-same-issues=0 --max-issues-per-linter=0 ./...0 errcheck findings (verified locally with a go1.26-built golangci-lint v2.12.1, matching CI's config)
  • go build ./... — clean
  • go test ./... — passing
  • gofmt — clean

Scope note

errcheck only. The repo has ~48 pre-existing gocritic/misspell/unused/staticcheck findings that CI tolerates (it runs golangci-lint in only-new-issues mode). Those are intentionally left untouched to avoid unrelated churn.

🤖 Generated with Claude Code

Check unchecked error/return values flagged by golangci-lint errcheck
(check-type-assertions enabled): discard intentional fmt.Fprint* writes to
stdout/io.Writer with _, _ =, guard test-side type assertions with require.True,
and check a deferred/plain Close. errcheck is now clean repo-wide.

Scope: errcheck only. Pre-existing gocritic/misspell/unused findings that CI
tolerates (only-new-issues mode) are intentionally left untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Review

Critical issues

None.

Security

No security concerns flagged.

Test coverage

Changes are errcheck-only mechanical fixes (discarded writes to stdout/writers, guarded type assertions, checked Close() returns); no new production logic requiring tests.

No critical issues — LGTM pending human review.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codex Review

No critical issues — LGTM pending human review.

Tests not run: go test was blocked because the read-only filesystem prevented Go from creating module/cache directories, including under /tmp.


Reviewed by Codex (gpt-5.5)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gemini Review

Critical Issues

None.

Security

No security concerns flagged.

Suggestions

  • In cmd/brutus/cmd_enum_lusha_test.go (around line 125), phones[0] is accessed immediately after the type assertion phones, ok := obj["phones"].([]interface{}). Consider adding require.Len(t, phones, 1) before indexing to prevent a potential out-of-bounds panic if the array is unexpectedly empty, mirroring the safer pattern used in other test cases (e.g., lines 80 and 513).

Reviewed by Gemini (gemini-3.1-pro-preview)

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 208496d0-fa21-4f8f-905a-0a8815c2ade5

📥 Commits

Reviewing files that changed from the base of the PR and between d3e6a58 and 7b467f7.

📒 Files selected for processing (10)
  • cmd/brutus/cmd_enum_github.go
  • cmd/brutus/cmd_enum_github_map.go
  • cmd/brutus/cmd_enum_google.go
  • cmd/brutus/cmd_enum_lusha_test.go
  • cmd/brutus/cmd_enum_teams.go
  • cmd/brutus/progress.go
  • examples/enum-custom-demo/main.go
  • internal/plugins/rdp/realframes_test.go
  • pkg/enum/github/github_test.go
  • pkg/enum/google/google_test.go

Walkthrough

This change set explicitly discards return values from fmt.Fprint/fmt.Fprintf calls and Close() calls across several CLI commands, the progress reporter, an example server, and test files, addressing unchecked-error lint findings without altering runtime behavior. Additionally, the Google enumeration command gains a new stdout heading line, and Lusha JSONL tests are hardened by replacing direct type assertions with checked assertions that fail explicitly on unexpected JSON structure.

Changes

Cohort / File(s) Change Summary
cmd_enum_github.go, cmd_enum_github_map.go, cmd_enum_teams.go Discard fmt.Fprintf return values for heading/banner writes
cmd_enum_google.go Add new stdout heading line in quiet/JSON-disabled path
progress.go Discard fmt.Fprint return values in Clear and flush
examples/enum-custom-demo/main.go Discard fmt.Fprint return values in handleIndex
internal/plugins/rdp/realframes_test.go Wrap file Close in deferred func discarding error
pkg/enum/github/github_test.go Discard Fprintf/Fprint returns in multiple test HTTP handlers
pkg/enum/google/google_test.go Discard listener Close() error
cmd_enum_lusha_test.go Replace direct type assertions with checked assertions for emails/phones

Sequence Diagram(s)

Not applicable; changes are localized error-handling and output adjustments without new interaction flows.

Related Issues: Not specified in provided data.

Related PRs: Not specified in provided data.

Suggested labels: cleanup, tests, lint

Suggested reviewers: Not specified in provided data.

Poem:
A rabbit hopped through Go code neat,
Discarding errors, tidy and fleet.
Fprint, Fprintf, Close all in line,
A banner added, Google's turn to shine.
Tests now check before they leap—
Clean code lets this rabbit sleep. 🐰

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/errcheck-lint-v170

Comment @coderabbitai help to get the list of available commands.

@UNC1739 UNC1739 merged commit 5d33e00 into main Jul 6, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant