Skip to content

chore: explicit, unique, greppable internal names - #14049

Open
ndeloof wants to merge 1 commit into
mainfrom
naming-explicit-greppable
Open

chore: explicit, unique, greppable internal names#14049
ndeloof wants to merge 1 commit into
mainfrom
naming-explicit-greppable

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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 service that actually holds a name-string, or a receiver c that 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.

  • string vs struct made visible: project/service/container parameters holding a name or ID become projectName/serviceName/containerID (the codebase's own majority convention — this fixes the stragglers)
  • honest receivers: c *monitorm; p *jsonWriterw (matching ttyWriter)
  • cryptic abbreviations spelled out: nw (meant two different types) → network/networkConfig, svcservice/serviceName/serviceCopy, oc/ocs, cnts, cnx
  • one name per concept: container.Summary loop variables unified on ctr; option structs unified on options (opts remains only for variadic functional options); fillBindMounts loses its p/s/m single-letters — one of which was shadowed by a loop variable of a different type

No 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.

@ndeloof
ndeloof requested review from a team as code owners August 14, 2026 21:08
@ndeloof
ndeloof requested a review from glours August 14, 2026 21:08
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
ndeloof force-pushed the naming-explicit-greppable branch from 045246a to 31331db Compare August 15, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant