[function-namer] Go function rename plan: pkg/linters/sprintfbool

Ouverte Adaptée aux débutants
#79,798 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
78/100
Type d'issue
Refactorisation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go
Domaine
devtools

Piste de recherche

Le travail se trouve dans pkg/linters/sprintfbool/sprintfbool.go. Commence par lire replacementForCall, qui est appelé depuis analyzeSprintfBool, et buildStrconvFmtImportEdits, qui est appelé depuis buildFormatBoolFix, puis fais un grep des nouveaux noms proposés pour confirmer qu'ils sont libres. Terminé signifie que les deux fonctions sont renommées avec leurs commentaires de doc mis à jour, qu'aucune référence aux anciens noms ne subsiste et que make test-unit passe.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

automated-analysis backlog:engineering-quality code-quality cookie refactoring
🏷️ Go Function Rename Plan

Package Analyzed: pkg/linters/sprintfbool
Analysis Date: 2026-11-21
Round-Robin Position: package 191 of 281 total packages
Functions Analyzed: 7 functions across 1 file

The round-robin pick at index 190 was a testdata fixture directory, so it was skipped and the next real package was analyzed.

Why This Matters

When AI coding agents search for functions to complete a task, they rely on function names to understand what code does. Clear, descriptive names increase the likelihood that an agent will find the right function instead of reimplementing existing logic.

Rename Suggestions
pkg/linters/sprintfbool/sprintfbool.go
Current Name Suggested Name Reason
replacementForCall() resolveFormatBoolReplacement() The name does not say what replacement is produced (strconv.FormatBool) or that it also decides whether the auto-fix is allowed (canFix). The sibling buildFormatBoolFix() already uses the FormatBool vocabulary, so this function is the outlier.
buildStrconvFmtImportEdits() buildFmtToStrconvImportEdits() The name does not show direction. The function adds the strconv import and removes fmt when it becomes orphaned, so the name should show the fmt to strconv swap.
All functions in this file (for reference)
  • analyzeSprintfBool() — ✅ Clear, no change needed
  • collectSprintfBoolCandidates() — ✅ Clear, no change needed
  • computeOrphanedFmtImportStatus() — ✅ Clear, no change needed
  • reportSprintfBoolDiagnostics() — ✅ Clear, no change needed
  • buildFormatBoolFix() — ✅ Clear, no change needed
  • buildStrconvFmtImportEdits() — ⚠️ Rename suggested (see table above)
  • replacementForCall() — ⚠️ Rename suggested (see table above)

Call sites (checked with Serena find_referencing_symbols and grep across pkg/ and cmd/, test files included):

  • replacementForCall: 1 caller, analyzeSprintfBool (sprintfbool.go:57)
  • buildStrconvFmtImportEdits: 1 caller, buildFormatBoolFix (sprintfbool.go:185)
  • No references in _test.go files, so no test updates are needed.
🤖 Agentic Implementation Plan
Agentic Implementation Plan

This issue is designed to be assigned to a coding agent. Implement both renames in a single pull request.

Prerequisites
  • Read replacementForCall and buildStrconvFmtImportEdits in pkg/linters/sprintfbool/sprintfbool.go and confirm each suggestion matches the function body
  • Confirm the new names are not already in use:
grep -rn "resolveFormatBoolReplacement\|buildFmtToStrconvImportEdits" --include="*.go" pkg/ cmd/
Implementation Steps
1. Rename replacementForCall to resolveFormatBoolReplacement

In pkg/linters/sprintfbool/sprintfbool.go:

  • Update the declaration (line 219)
  • Update the single call site in analyzeSprintfBool (line 57)
// Old
func replacementForCall(pass *analysis.Pass, call *ast.CallExpr, arg ast.Expr, file *ast.File) replacement {

// New
func resolveFormatBoolReplacement(pass *analysis.Pass, call *ast.CallExpr, arg ast.Expr, file *ast.File) replacement {
2. Rename buildStrconvFmtImportEdits to buildFmtToStrconvImportEdits
  • Update the declaration (line 198) and its doc comment (lines 194-197) so the comment starts with the new name
  • Update the single call site in buildFormatBoolFix (line 185)
3. Verify no old references remain
grep -rn "replacementForCall\|buildStrconvFmtImportEdits" --include="*.go" pkg/ cmd/

Expected: no matches after the rename.

4. Format, build, and test
make fmt
make build
make test-unit
make lint
Commit Convention
refactor: rename replacementForCall and buildStrconvFmtImportEdits for clarity
Validation Checklist
  • Both renames implemented in sprintfbool.go only
  • Doc comments updated to match the new names
  • No remaining references to the old names
  • make fmt produces no diff
  • make build passes
  • make test-unit passes (analysistest fixtures under testdata/ are unaffected)
  • make lint passes
  • PR description explains the agent-discoverability rationale
Notes for the Agent
  • This is a pure rename refactor. Behavior must not change.
  • Both functions are unexported, so no interface constraints apply.
  • If a rename conflicts with an existing identifier, skip it and explain why in the PR.

References: §44900201111

Generated by 🔧 Daily Go Function Namer · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.3K · ◷

  • expires on Nov 28, 2026, 3:48 AM UTC-08:00
Langage dominant
Go
Étoiles
5.7k
Forks
635
Merge moyen
3 h 43 min
PR mergées (30 j)
838

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/gh-aw

Toutes les issues de github/gh-aw

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.