chore: explicit, unique, greppable internal names - #14049
Open
ndeloof wants to merge 1 commit into
Open
Conversation
Rename-only change, no behavior difference, no exported identifier renamed (only parameter names of a few exported functions, which are not part of the Go API). - names that hide what a value is: parameters holding a *name* or *ID* while named like the object — project→projectName, service→serviceName, container→containerID — so string vs struct is readable at every call site without opening the signature - misleading receivers: monitor methods used c (reads as client/container/CLI) → m; jsonWriter used p while its ttyWriter sibling uses w → w - cryptic abbreviations with non-trivial scope: nw (meant both network.Summary and types.NetworkConfig) → network/networkConfig, svc → service/serviceName/serviceCopy, oc/ocs → observedContainer(s), cnts → serviceContainers, cnx → attachResponse - container.Summary loop variables unified on ctr (was a c/ctr mix); fillBindMounts also dropped its p/s/m single-letters, one of which was shadowed by a loop variable of a different type - option-struct identifiers unified on options (opts remains only for variadic functional options); ambiguous ones get a precise name (bindOptions, networkCreateOptions, projectOptionsFns) Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
force-pushed
the
naming-explicit-greppable
branch
from
August 15, 2026 05:24
045246a to
31331db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rename-only: make internal identifiers explicit, unique and greppable. Ambiguous names are a first-order source of errors when a coding agent works on the codebase — a parameter named
servicethat actually holds a name-string, or a receivercthat reads as client/container, sends both agents and humans down the wrong path; explicit names remove the guesswork for one and the re-reading for the other.project/service/containerparameters holding a name or ID becomeprojectName/serviceName/containerID(the codebase's own majority convention — this fixes the stragglers)c *monitor→m;p *jsonWriter→w(matchingttyWriter)nw(meant two different types) →network/networkConfig,svc→service/serviceName/serviceCopy,oc/ocs,cnts,cnxcontainer.Summaryloop variables unified onctr; option structs unified onoptions(optsremains only for variadic functional options);fillBindMountsloses itsp/s/msingle-letters — one of which was shadowed by a loop variable of a different typeNo exported identifier is renamed (only parameter names of a few exported functions, which are not part of the Go API). No behavior change; unit tests and golangci-lint pass.