Merge pull request #51265 from thaJeztah/client_gofumpt

client: gofumpt
This commit is contained in:
Sebastiaan van Stijn
2025-10-22 14:11:02 +02:00
committed by GitHub
13 changed files with 28 additions and 33 deletions

View File

@@ -46,7 +46,8 @@ func TestImageHistory(t *testing.T) {
ID: "image_id2",
Tags: []string{"tag1", "tag2"},
},
}}
},
}
imageHistories, err := client.ImageHistory(context.Background(), "image_id", ImageHistoryWithPlatform(ocispec.Platform{
Architecture: "arm64",

View File

@@ -23,10 +23,10 @@ type ImagePullResponse interface {
// It executes the privileged function if the operation is unauthorized
// and it tries one more time.
// Callers can:
// - use [ImagePullResponse.Wait] to wait for pull to complete
// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
// - use [ImagePullResponse.Wait] to wait for pull to complete
// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
// FIXME(vdemeester): there is currently used in a few way in docker/docker
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty

View File

@@ -27,10 +27,10 @@ type ImagePushResponse interface {
// It executes the privileged function if the operation is unauthorized
// and it tries one more time.
// Callers can
// - use [ImagePushResponse.Wait] to wait for push to complete
// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
// - use [ImagePushResponse.Wait] to wait for push to complete
// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
ref, err := reference.ParseNormalizedNamed(image)
if err != nil {

View File

@@ -5,8 +5,7 @@ import (
"net/url"
)
type NodeRemoveResult struct {
}
type NodeRemoveResult struct{}
// NodeRemove removes a Node.
func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) {

View File

@@ -5,8 +5,7 @@ import (
"net/url"
)
type NodeUpdateResult struct {
}
type NodeUpdateResult struct{}
// NodeUpdate updates a Node.
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) {

View File

@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error]
// each [JSONMessage] to out.
// see DisplayJSONMessages for details
func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
var dec = json.NewDecoder(in)
dec := json.NewDecoder(in)
var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
for {
var jm JSONMessage
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
// called if a JSONMessage contains an Aux field, in which case
// DisplayJSONMessagesStream does not present the JSONMessage.
func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
var ids = make(map[string]uint)
ids := make(map[string]uint)
for jm, err := range messages {
var diff uint

View File

@@ -1,5 +1,4 @@
package client
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct {
}
type NodeInspectOptions struct{}

View File

@@ -23,10 +23,10 @@ type ImagePullResponse interface {
// It executes the privileged function if the operation is unauthorized
// and it tries one more time.
// Callers can:
// - use [ImagePullResponse.Wait] to wait for pull to complete
// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
// - use [ImagePullResponse.Wait] to wait for pull to complete
// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
// FIXME(vdemeester): there is currently used in a few way in docker/docker
// - if not in trusted content, ref is used to pass the whole reference, and tag is empty

View File

@@ -27,10 +27,10 @@ type ImagePushResponse interface {
// It executes the privileged function if the operation is unauthorized
// and it tries one more time.
// Callers can
// - use [ImagePushResponse.Wait] to wait for push to complete
// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
// - use [ImagePushResponse.Wait] to wait for push to complete
// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
// of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
ref, err := reference.ParseNormalizedNamed(image)
if err != nil {

View File

@@ -5,8 +5,7 @@ import (
"net/url"
)
type NodeRemoveResult struct {
}
type NodeRemoveResult struct{}
// NodeRemove removes a Node.
func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) {

View File

@@ -5,8 +5,7 @@ import (
"net/url"
)
type NodeUpdateResult struct {
}
type NodeUpdateResult struct{}
// NodeUpdate updates a Node.
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) {

View File

@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error]
// each [JSONMessage] to out.
// see DisplayJSONMessages for details
func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
var dec = json.NewDecoder(in)
dec := json.NewDecoder(in)
var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
for {
var jm JSONMessage
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
// called if a JSONMessage contains an Aux field, in which case
// DisplayJSONMessagesStream does not present the JSONMessage.
func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
var ids = make(map[string]uint)
ids := make(map[string]uint)
for jm, err := range messages {
var diff uint

View File

@@ -1,5 +1,4 @@
package client
// NodeInspectOptions holds parameters to inspect nodes with.
type NodeInspectOptions struct {
}
type NodeInspectOptions struct{}