Skip to content

client/image: Wrap result and options in structs#51227

Merged
austinvazquez merged 6 commits intomoby:masterfrom
vvoland:client-image-opts
Oct 22, 2025
Merged

client/image: Wrap result and options in structs#51227
austinvazquez merged 6 commits intomoby:masterfrom
vvoland:client-image-opts

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Oct 20, 2025

`client.ImageBuild`, `client.BuildCancel`, `client.ImageList`, `client.ImageRemove`, `client.ImageTag`, and `client.ImageSearch` methods now accept option structs instead of positional arguments, and return dedicated result structs.

Comment on lines 10 to 13
type ImageSearchResult struct {
Results []registry.SearchResult
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit awkward with Result -> Results -> Result, but I guess it's better to keep it consistent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also consider making this RegistrySearch or ... something something registry, because we only search remote, not local images.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, Registry sounds good for this one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps for these we should use Items ; also see

@vvoland vvoland added impact/changelog kind/refactor PR's that refactor, or clean-up code area/go-sdk impact/go-sdk Noteworthy (compatibility changes) in the Go SDK and removed area/dependencies labels Oct 20, 2025
@vvoland vvoland added this to the 29.0.0 milestone Oct 20, 2025
@vvoland vvoland marked this pull request as ready for review October 20, 2025 17:44
@vvoland vvoland force-pushed the client-image-opts branch 3 times, most recently from 8ca6d1b to 373f2cd Compare October 20, 2025 18:41
Comment on lines +12 to +20
type ImageTagOptions struct {
Source string
Target string
}

type ImageTagResult struct{}

// ImageTag tags an image in the docker host
func (cli *Client) ImageTag(ctx context.Context, source, target string) error {
func (cli *Client) ImageTag(ctx context.Context, options ImageTagOptions) (ImageTagResult, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one I ended up extracting both Source and Target to the options struct to make it easier to distinguish between source vs target image.

@thaJeztah thaJeztah added the release-blocker PRs we want to block a release on label Oct 21, 2025
Comment on lines 21 to 24
// ImageListResult holds the result from ImageList.
type ImageListResult struct {
Images []image.Summary
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps here as well; Items could work as something we can apply to all the list functions;

@austinvazquez WDYT?

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@austinvazquez austinvazquez merged commit 9821df9 into moby:master Oct 22, 2025
181 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/dependencies area/go-sdk area/images Image Distribution impact/changelog impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code module/client release-blocker PRs we want to block a release on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants