mirror of
https://github.com/docker/compose.git
synced 2026-10-12 02:13:08 +00:00
Inline small functions that were extracted from their single call site without a real boundary to justify it — no reuse, no dedicated test, no responsibility of their own — so each caller now tells its whole story top-down: - getExecTarget, attachContainer, logContainer: one-line trampolines to getSpecifiedContainer / doAttachContainer / doLogContainer, which other call sites already use directly - removeImage: single-statement wrapper, unlike its removeVolume sibling which has actual logic - checkSelectedServices: named like a validation, actually a filter; the subtle rule (an unknown service is only an error with an explicit compose file) now reads where options.Services is rewritten - prepareLabels: mutated the map it received while looking pure at the call site; the label writes are now visible in getCreateConfigs - setDefaultTarget: mutation-by-pointer of the loop copy, now visible in the loop of injectFileReferences - buildVolumeOptions/buildTmpfsOptions/buildImageOptions: nil-guard + field copies; the buildMountOptions switch now shows side by side what each mount type propagates (buildBindOption keeps real logic and keeps buildMountOptions under the gocyclo limit) - displayDryRunBuildEvent: was longer than its only caller - hasMore: read like a predicate, was a one-line spinner restart - escapeDollarSign: wrapped a single bytes.ReplaceAll - extractEnvCLIDefined: replaced by the canonical compose-go helper types.NewMappingWithEquals().ToMapping(), as run.go already does - isPullPolicyValid: rebuilt the valid-values slice on every call; now a package-level list checked at the call site - viewFromStackList: projection now sits next to the render closure that consumes exactly its three fields No behavior change; single gocyclo threshold untouched. Signed-off-by: Nicolas De Loof <[email protected]>