GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore: fix golangci-lint findings (dead code, ineffassign, staticcheck) by euxarist · Pull Request #527 · Twigpine/zero

Conversation

@euxarist

@euxarist euxarist commented Jul 5, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

Small cleanup pass from running golangci-lint locally (installed it after CodeRabbit's truncateHeadTail nitpick on #476 turned out to have no equivalent check in this repo's actual CI, which only runs go vet).

Changes

  • Remove three unused functions found by the unused linter: safeRequestedPrefix, safeShellCommandTokens (internal/agent/command_prefix.go), and truncateHeadTail (internal/tools/bash.go). Each was a thin wrapper with no remaining callers.
  • Drop an ineffectual assignment in stringListArgWebSearch (internal/tools/web_search.go): every return path after it already sets the named return explicitly, so the assignment never took effect.
  • Simplify a negated-and condition in partition_cache_stable_test.go via De Morgan's law.
  • Use strings.Contains instead of strings.Index(...) < 0 in edit_replacers.go.
  • Fix error string style (staticcheck ST1005): lowercase "unsafe redirect URL" and drop the trailing period from webFetchPublicOnlyHint in web_fetch.go, updating the one test that asserted on the old casing.

Deliberately left the errcheck findings (unchecked defer file.Close() / response.Body.Close() / Write() errors) alone. Those are stylistic, not correctness bugs, and this repo's CI doesn't run golangci-lint at all, so there's no actual gate to satisfy there.

Test plan

  • go build ./...
  • go vet ./... (clean, matches actual CI)
  • go test ./internal/agent/... ./internal/tools/... (pass)
  • golangci-lint run ./internal/agent/... ./internal/tools/... --enable-only unused,ineffassign,staticcheck (0 issues, down from 6)

Summary by CodeRabbit

  • Bug Fixes

    • Improved the wording and consistency of a few error messages shown during unsafe redirect handling and web fetch prompts.
    • Tightened validation and matching behavior in some command and edit workflows for more reliable results.
  • Refactor

    • Simplified several internal code paths and cleanup logic without changing expected user-facing behavior.
    • Updated test assertions to better reflect the current output format.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@euxarist
chore: fix golangci-lint findings (dead code, ineffassign, staticcheck)
14f60dc
- Remove unused safeRequestedPrefix, safeShellCommandTokens
  (internal/agent/command_prefix.go), and truncateHeadTail
  (internal/tools/bash.go): each was a thin wrapper with no remaining
  callers.
- Drop an ineffectual assignment in stringListArgWebSearch: every
  return path after it already sets the named return explicitly.
- Simplify a negated-and condition in
  partition_cache_stable_test.go via De Morgan's law.
- Use strings.Contains instead of strings.Index(...) < 0 in
  edit_replacers.go.
- Fix error string style (ST1005): lowercase "unsafe redirect URL"
  and drop the trailing period from webFetchPublicOnlyHint.

Skipped the errcheck findings on this pass (unchecked defer
Close()/Write() errors): those are stylistic, not correctness bugs,
and this repo's CI only runs go vet, not golangci-lint.
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a7753e38-d345-471c-aa32-e799c5a9b48e

📥 Commits

Reviewing files that changed from the base of the PR and between 95ccd5b and 14f60dc.

📒 Files selected for processing (7)
  • internal/agent/command_prefix.go
  • internal/agent/partition_cache_stable_test.go
  • internal/tools/bash.go
  • internal/tools/edit_replacers.go
  • internal/tools/web_fetch.go
  • internal/tools/web_fetch_test.go
  • internal/tools/web_search.go
💤 Files with no reviewable changes (3)
  • internal/tools/web_search.go
  • internal/agent/command_prefix.go
  • internal/tools/bash.go

Walkthrough

This PR removes unused helper functions (safeRequestedPrefix, safeShellCommandTokens, truncateHeadTail), simplifies a test conditional and a fuzzy-match check, adjusts message casing/punctuation in web_fetch.go with corresponding test updates, and removes a redundant assignment in web_search.go.

Changes

Cleanup and minor fixes

Layer / File(s) Summary
Remove unused command-prefix helpers
internal/agent/command_prefix.go
Deletes the unused safeRequestedPrefix and safeShellCommandTokens internal helper functions.
Simplify cache ordering test assertion
internal/agent/partition_cache_stable_test.go
Rewrites a negated compound condition into direct >= comparisons for verifying tool ordering.
Remove unused truncateHeadTail helper
internal/tools/bash.go
Deletes truncateHeadTail, leaving truncateHeadTailWithTotal as the sole truncation implementation.
Simplify fuzzy edit candidate check
internal/tools/edit_replacers.go
Replaces strings.Index(...) < 0 with !strings.Contains(...) for equivalent candidate validation.
Adjust web fetch message casing/punctuation
internal/tools/web_fetch.go, internal/tools/web_fetch_test.go
Removes trailing period from a hint string and lowercases "unsafe redirect URL" in the error message, updating the test assertion accordingly.
Simplify provided flag handling
internal/tools/web_search.go
Removes a redundant standalone provided = true assignment, relying on later explicit returns.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • Gitlawb/zero#218: Both PRs modify the domains argument parsing/validation logic in stringListArgWebSearch.
  • Gitlawb/zero#322: Related to the same command-prefix helper removal tied to a segment-based prefix refactor.
  • Gitlawb/zero#506: Both PRs touch fuzzyEditMatch's candidate validation logic in edit_replacers.go.

Suggested reviewers: gnanam1990, anandh8x, Vasanthdev2004

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the cleanup pass fixing golangci-lint findings across dead code, ineffassign, and staticcheck issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot approved these changes Jul 5, 2026
View reviewed changes
@euxarist euxarist mentioned this pull request Jul 5, 2026
ci: add golangci-lint as an advisory check #528
Merged
jatmn
jatmn approved these changes Jul 5, 2026
View reviewed changes

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@Vasanthdev2004

Findings

  • [P2] Tie this cleanup to an approved parent issue or maintainer-approved scope
    CONTRIBUTING.md:45
    This PR is from a CONTRIBUTOR account and does not link an approved parent issue, but the project contribution policy says all community PRs require an approved parent issue with the issue-approved label before implementation starts. The change is also a cleanup/refactor pass driven by local golangci-lint output rather than a linked approved bug or feature, which falls under the same scope rule. Please link the approved issue for this cleanup, or get explicit maintainer approval for taking this contributor cleanup outside the issue-first flow.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kevincodex1 pushed a commit that referenced this pull request Jul 6, 2026
@euxarist
ci: add golangci-lint as an advisory check (#528)
56147a7
go vet, gofmt, govulncheck, and deadcode don't catch unused private
functions/assignments reachable within a package but never called, or
staticcheck-style correctness/readability issues. deadcode's whole-program
reachability analysis specifically missed several of these; golangci-lint's
truncateHeadTail nitpick on #476 assumed it would fail CI, but nothing in
this repo actually ran it.

Scoped to unused, ineffassign, and staticcheck rather than the full default
battery, and continue-on-error like deadcode, so this surfaces the existing
findings across the repo (being cleaned up incrementally per #527) without
blocking in-flight PRs on a big-bang adoption.
kevincodex1
kevincodex1 approved these changes Jul 6, 2026
View reviewed changes

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kevincodex1
kevincodex1 merged commit 8c6c49a into Twigpine:main Jul 6, 2026
7 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@PierrunoYT PierrunoYT mentioned this pull request Jul 14, 2026
Fix pinned Go quality tools on Go 1.26 #689
Merged
@euxarist
euxarist deleted the fix/lint-cleanup-main branch July 17, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jatmn jatmn jatmn approved these changes
@coderabbitai coderabbitai[bot] coderabbitai[bot] approved these changes
@kevincodex1 kevincodex1 kevincodex1 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@euxarist @jatmn @kevincodex1
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.