You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a new stringsjoinone custom linter that reports strings.Join([]string{s}, sep) calls with a single-element slice literal.
What it catches
When strings.Join is called with a slice literal that contains exactly one element, the separator is never used and the call is equivalent to just returning that element. This is a code smell — likely a refactoring artifact where a multi-element slice was reduced to one element, or a misuse of the API.
Before:
result:=strings.Join([]string{name}, ", ")
After (suggested fix):
result:=name
Evidence
This pattern was identified by scanning the codebase for redundant strings.Join calls. The linter is specific and actionable (clear fix), and has very low false-positive potential because a single-element strings.Join is always equivalent to the bare element.
Implementation
New package: pkg/linters/stringsjoinone/
Registered in pkg/linters/registry.go
Documented in pkg/linters/doc.go and pkg/linters/README.md
Tests with fixture and golden file pass
go build ./cmd/linters succeeds
Warning
Protected Files — Push Permission Denied
This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.
Protected files
README.md
The push was rejected because GitHub Actions does not have workflows permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.
Create the pull request manually
# Download the patch from the workflow run
gh run download 29854609552 -n agent -D /tmp/agent-29854609552
# Create a new branch
git checkout -b linter-miner/stringsjoinone-0e3c9b58b22ae9d5 main
# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-29854609552/aw-linter-miner-stringsjoinone.patch
# Push the branch and create the pull request
git push origin linter-miner/stringsjoinone-0e3c9b58b22ae9d5
gh pr create --title '[linter-miner] feat(linters): add stringsjoinone linter' --base main --head linter-miner/stringsjoinone-0e3c9b58b22ae9d5 --repo github/gh-aw
Summary
Adds a new
stringsjoinonecustom linter that reportsstrings.Join([]string{s}, sep)calls with a single-element slice literal.What it catches
When
strings.Joinis called with a slice literal that contains exactly one element, the separator is never used and the call is equivalent to just returning that element. This is a code smell — likely a refactoring artifact where a multi-element slice was reduced to one element, or a misuse of the API.Before:
After (suggested fix):
Evidence
This pattern was identified by scanning the codebase for redundant
strings.Joincalls. The linter is specific and actionable (clear fix), and has very low false-positive potential because a single-elementstrings.Joinis always equivalent to the bare element.Implementation
pkg/linters/stringsjoinone/pkg/linters/registry.gopkg/linters/doc.goandpkg/linters/README.mdgo build ./cmd/linterssucceedsWarning
Protected Files — Push Permission Denied
This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.
Protected files
README.mdThe push was rejected because GitHub Actions does not have
workflowspermission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.Create the pull request manually