Skip to content

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 20, 2025

Moves ParseVolume() to a new internal package to remove the dependency on cli/compose/loader in cli/command/container/opts.go

refactor to keep types isolated

  • rename the package to "volumespec" to reuse the name of the package as part of the name (parsevolume.ParseVolume() -> volumespec.Parse())
  • move the related compose types to the internal package as well, and rename them to be more generic (not associated with "compose");
    • ServiceVolumeConfig -> VolumeConfig
    • ServiceVolumeBind -> BindOpts
    • ServiceVolumeVolume -> VolumeOpts
    • ServiceVolumeImage -> ImageOpts
    • ServiceVolumeTmpfs -> TmpFsOpts
    • ServiceVolumeCluster -> ClusterOpts
  • alias the internal types inside cli/compose/types to keep backward compatibility (for any external consumers); even though the implementation is internal, Go allows aliasing types to use them externally.

(cherry picked from commit ef7fd8b)

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

Moves ParseVolume() to a new internal package to remove the dependency
on cli/compose/loader in cli/command/container/opts.go

refactor to keep types isolated

- rename the package to "volumespec" to reuse the name of the package
  as part of the name (parsevolume.ParseVolume() -> volumespec.Parse())
- move the related compose types to the internal package as well,
  and rename them to be more generic (not associated with "compose");
  - ServiceVolumeConfig -> VolumeConfig
  - ServiceVolumeBind -> BindOpts
  - ServiceVolumeVolume -> VolumeOpts
  - ServiceVolumeImage -> ImageOpts
  - ServiceVolumeTmpfs -> TmpFsOpts
  - ServiceVolumeCluster -> ClusterOpts
- alias the internal types inside cli/compose/types to keep backward
  compatibility (for any external consumers); even though the implementation
  is internal, Go allows aliasing types to use them externally.

Signed-off-by: Michael Tews <michael@tews.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ef7fd8b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title refactor(cli/compose/loader): extract ParseVolume() to its own package [28.x backport] refactor(cli/compose/loader): extract ParseVolume() to its own package Aug 20, 2025
@thaJeztah thaJeztah added this to the 29.0.0 milestone Aug 20, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/compose/loader/loader.go 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Aug 20, 2025
@thaJeztah thaJeztah marked this pull request as ready for review August 20, 2025 15:05
@thaJeztah thaJeztah merged commit 5ef48d6 into docker:28.x Aug 20, 2025
103 of 106 checks passed
@thaJeztah thaJeztah deleted the 28.x_backport_issue_6188 branch August 20, 2025 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants