Go Function Rename Plan
Package Analyzed: pkg/sliceutil
Analysis Date: 2026-05-12
Round-Robin Position: package 13 of 23 total packages
Functions Analyzed: 8 functions across 1 file
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.
Functions in the same package also call each other, so reviewing them together gives
better context for rename decisions.
Rename Suggestions
pkg/sliceutil/sliceutil.go
| Current Name |
Suggested Name |
Reason |
MapToSlice[K comparable, V any](m map[K]V) []K |
MapKeys[K comparable, V any](m map[K]V) []K |
MapToSlice is ambiguous — it sounds like “convert a map to a slice” without telegraphing whether the slice contains keys, values, or [K,V] pairs. The function actually returns only the keys. MapKeys mirrors Go’s stdlib maps.Keys and matches how agents phrase the intent (“get the keys of a map as a slice”). 14 call sites confirm it’s a high-traffic helper where a clearer name pays off. |
All functions in pkg/sliceutil/sliceutil.go (for reference):
Filter[T any] — ✅ Universal FP name, immediately recognizable. No change.
Map[T, U any] — ✅ Universal FP name. No change.
MapToSlice[K, V] — ⚠️ Rename suggested (see table above).
FilterMapKeys[K, V] — ✅ Accurately describes “filter and return map keys”. No change.
Any[T any] — ✅ Standard FP name; matches slices.ContainsFunc semantics. No change.
Deduplicate[T comparable] — ✅ Clear verb describing the action. No change.
MergeUnique[T comparable] — ✅ Clearly reads as “merge while keeping unique items”. No change.
Exclude[T comparable] — ✅ Clear verb. No change.
🤖 Agentic Implementation Plan
Agentic Implementation Plan
This issue is designed to be assigned to a coding agent. The agent should implement
the single rename suggestion below in one focused pull request.
Prerequisites
Implementation Steps
1. Rename the function in pkg/sliceutil/sliceutil.go
// Old
func MapToSlice[K comparable, V any](m map[K]V) []K {
// New
func MapKeys[K comparable, V any](m map[K]V) []K {
Update the function’s doc comment to lead with MapKeys and clarify it returns map keys as a slice with undefined order.
2. Update all call sites
Find every caller — there are 14 in production code plus README/docs references:
grep -rn "sliceutil\.MapToSlice\b" pkg/ --include="*.go"
grep -rn "sliceutil\.MapToSlice\b" docs/ pkg/sliceutil/README.md
Known call sites at time of analysis:
pkg/cli/firewall_log.go (2 calls, lines 357–358)
pkg/cli/audit_report_render_guard.go (line 47)
pkg/cli/run_push.go (line 120)
pkg/cli/gateway_logs_render.go (lines 159, 189)
pkg/workflow/mcp_setup_generator.go (lines 404, 439, 546, 619, 737)
pkg/workflow/yaml_env_helpers.go (line 38)
pkg/workflow/mcp_config_custom.go (lines 364, 457, 474)
- Plus any test files that exercise the helper (
grep -rn "MapToSlice" pkg/)
pkg/sliceutil/README.md if MapToSlice is mentioned
3. Verify compilation after the rename
4. Run tests and lints after the rename
Commit Convention
refactor: rename sliceutil.MapToSlice to MapKeys for clarity
Validation Checklist
Notes for the Agent
- This is a pure rename refactor — behavior must not change, only the name.
- If any call site reveals a name collision (e.g., a local
MapKeys variable in the same scope), pick a minimal local rename for the variable; do not rebrand the helper.
- Follow existing naming conventions documented in
AGENTS.md.
- The other 7 functions in
pkg/sliceutil (Filter, Map, FilterMapKeys, Any, Deduplicate, MergeUnique, Exclude) were reviewed and intentionally left as-is — do not rename them in the same PR.
Generated by the Daily Go Function Namer workflow
Run: §25733896422
References:
Generated by Daily Go Function Namer · ● 3.6M · ◷
Go Function Rename Plan
Package Analyzed:
pkg/sliceutilAnalysis Date: 2026-05-12
Round-Robin Position: package 13 of 23 total packages
Functions Analyzed: 8 functions across 1 file
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.
Functions in the same package also call each other, so reviewing them together gives
better context for rename decisions.
Rename Suggestions
pkg/sliceutil/sliceutil.goMapToSlice[K comparable, V any](m map[K]V) []KMapKeys[K comparable, V any](m map[K]V) []KMapToSliceis ambiguous — it sounds like “convert a map to a slice” without telegraphing whether the slice contains keys, values, or[K,V]pairs. The function actually returns only the keys.MapKeysmirrors Go’s stdlibmaps.Keysand matches how agents phrase the intent (“get the keys of a map as a slice”). 14 call sites confirm it’s a high-traffic helper where a clearer name pays off.All functions in
pkg/sliceutil/sliceutil.go(for reference):Filter[T any]— ✅ Universal FP name, immediately recognizable. No change.Map[T, U any]— ✅ Universal FP name. No change.MapToSlice[K, V]—FilterMapKeys[K, V]— ✅ Accurately describes “filter and return map keys”. No change.Any[T any]— ✅ Standard FP name; matchesslices.ContainsFuncsemantics. No change.Deduplicate[T comparable]— ✅ Clear verb describing the action. No change.MergeUnique[T comparable]— ✅ Clearly reads as “merge while keeping unique items”. No change.Exclude[T comparable]— ✅ Clear verb. No change.🤖 Agentic Implementation Plan
Agentic Implementation Plan
This issue is designed to be assigned to a coding agent. The agent should implement
the single rename suggestion below in one focused pull request.
Prerequisites
pkg/sliceutil/sliceutil.goMapToSlicethat would constrain the rename (it’s a top-level generic free function, so this should be safe)Implementation Steps
1. Rename the function in
pkg/sliceutil/sliceutil.goUpdate the function’s doc comment to lead with
MapKeysand clarify it returns map keys as a slice with undefined order.2. Update all call sites
Find every caller — there are 14 in production code plus README/docs references:
Known call sites at time of analysis:
pkg/cli/firewall_log.go(2 calls, lines 357–358)pkg/cli/audit_report_render_guard.go(line 47)pkg/cli/run_push.go(line 120)pkg/cli/gateway_logs_render.go(lines 159, 189)pkg/workflow/mcp_setup_generator.go(lines 404, 439, 546, 619, 737)pkg/workflow/yaml_env_helpers.go(line 38)pkg/workflow/mcp_config_custom.go(lines 364, 457, 474)grep -rn "MapToSlice" pkg/)pkg/sliceutil/README.mdifMapToSliceis mentioned3. Verify compilation after the rename
4. Run tests and lints after the rename
Commit Convention
Validation Checklist
pkg/sliceutil/sliceutil.goand doc comment updatedpkg/cli/andpkg/workflow/MapToSlice)pkg/sliceutil/README.mdupdated if it mentions the old namemake buildpasses with no errorsmake test-unitpassesmake lintpassesmaps.Keysconvention)Notes for the Agent
MapKeysvariable in the same scope), pick a minimal local rename for the variable; do not rebrand the helper.AGENTS.md.pkg/sliceutil(Filter,Map,FilterMapKeys,Any,Deduplicate,MergeUnique,Exclude) were reviewed and intentionally left as-is — do not rename them in the same PR.Generated by the Daily Go Function Namer workflow
Run: §25733896422
References: