Browse code

client: gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2025/10/22 21:01:01
Showing 13 changed files
... ...
@@ -46,7 +46,8 @@ func TestImageHistory(t *testing.T) {
46 46
 				ID:   "image_id2",
47 47
 				Tags: []string{"tag1", "tag2"},
48 48
 			},
49
-		}}
49
+		},
50
+	}
50 51
 
51 52
 	imageHistories, err := client.ImageHistory(context.Background(), "image_id", ImageHistoryWithPlatform(ocispec.Platform{
52 53
 		Architecture: "arm64",
... ...
@@ -23,10 +23,10 @@ type ImagePullResponse interface {
23 23
 // It executes the privileged function if the operation is unauthorized
24 24
 // and it tries one more time.
25 25
 // Callers can:
26
-// - use [ImagePullResponse.Wait] to wait for pull to complete
27
-// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
28
-//   of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
29
-// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
26
+//   - use [ImagePullResponse.Wait] to wait for pull to complete
27
+//   - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
28
+//     of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
29
+//   - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
30 30
 func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
31 31
 	// FIXME(vdemeester): there is currently used in a few way in docker/docker
32 32
 	// - if not in trusted content, ref is used to pass the whole reference, and tag is empty
... ...
@@ -27,10 +27,10 @@ type ImagePushResponse interface {
27 27
 // It executes the privileged function if the operation is unauthorized
28 28
 // and it tries one more time.
29 29
 // Callers can
30
-// - use [ImagePushResponse.Wait] to wait for push to complete
31
-// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
32
-//   of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
33
-// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
30
+//   - use [ImagePushResponse.Wait] to wait for push to complete
31
+//   - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
32
+//     of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
33
+//   - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
34 34
 func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
35 35
 	ref, err := reference.ParseNormalizedNamed(image)
36 36
 	if err != nil {
... ...
@@ -5,8 +5,7 @@ import (
5 5
 	"net/url"
6 6
 )
7 7
 
8
-type NodeRemoveResult struct {
9
-}
8
+type NodeRemoveResult struct{}
10 9
 
11 10
 // NodeRemove removes a Node.
12 11
 func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) {
... ...
@@ -5,8 +5,7 @@ import (
5 5
 	"net/url"
6 6
 )
7 7
 
8
-type NodeUpdateResult struct {
9
-}
8
+type NodeUpdateResult struct{}
10 9
 
11 10
 // NodeUpdate updates a Node.
12 11
 func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) {
... ...
@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error]
195 195
 // each [JSONMessage] to out.
196 196
 // see DisplayJSONMessages for details
197 197
 func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
198
-	var dec = json.NewDecoder(in)
198
+	dec := json.NewDecoder(in)
199 199
 	var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
200 200
 		for {
201 201
 			var jm JSONMessage
... ...
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
229 229
 //     called if a JSONMessage contains an Aux field, in which case
230 230
 //     DisplayJSONMessagesStream does not present the JSONMessage.
231 231
 func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
232
-	var ids = make(map[string]uint)
232
+	ids := make(map[string]uint)
233 233
 
234 234
 	for jm, err := range messages {
235 235
 		var diff uint
... ...
@@ -1,5 +1,4 @@
1 1
 package client
2 2
 
3 3
 // NodeInspectOptions holds parameters to inspect nodes with.
4
-type NodeInspectOptions struct {
5
-}
4
+type NodeInspectOptions struct{}
... ...
@@ -23,10 +23,10 @@ type ImagePullResponse interface {
23 23
 // It executes the privileged function if the operation is unauthorized
24 24
 // and it tries one more time.
25 25
 // Callers can:
26
-// - use [ImagePullResponse.Wait] to wait for pull to complete
27
-// - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
28
-//   of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
29
-// - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
26
+//   - use [ImagePullResponse.Wait] to wait for pull to complete
27
+//   - use [ImagePullResponse.JSONMessages] to monitor pull progress as a sequence
28
+//     of JSONMessages, [ImagePullResponse.Close] does not need to be called in this case.
29
+//   - use the [io.Reader] interface and call [ImagePullResponse.Close] after processing.
30 30
 func (cli *Client) ImagePull(ctx context.Context, refStr string, options ImagePullOptions) (ImagePullResponse, error) {
31 31
 	// FIXME(vdemeester): there is currently used in a few way in docker/docker
32 32
 	// - if not in trusted content, ref is used to pass the whole reference, and tag is empty
... ...
@@ -27,10 +27,10 @@ type ImagePushResponse interface {
27 27
 // It executes the privileged function if the operation is unauthorized
28 28
 // and it tries one more time.
29 29
 // Callers can
30
-// - use [ImagePushResponse.Wait] to wait for push to complete
31
-// - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
32
-//   of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
33
-// - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
30
+//   - use [ImagePushResponse.Wait] to wait for push to complete
31
+//   - use [ImagePushResponse.JSONMessages] to monitor pull progress as a sequence
32
+//     of JSONMessages, [ImagePushResponse.Close] does not need to be called in this case.
33
+//   - use the [io.Reader] interface and call [ImagePushResponse.Close] after processing.
34 34
 func (cli *Client) ImagePush(ctx context.Context, image string, options ImagePushOptions) (ImagePushResponse, error) {
35 35
 	ref, err := reference.ParseNormalizedNamed(image)
36 36
 	if err != nil {
... ...
@@ -5,8 +5,7 @@ import (
5 5
 	"net/url"
6 6
 )
7 7
 
8
-type NodeRemoveResult struct {
9
-}
8
+type NodeRemoveResult struct{}
10 9
 
11 10
 // NodeRemove removes a Node.
12 11
 func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options NodeRemoveOptions) (NodeRemoveResult, error) {
... ...
@@ -5,8 +5,7 @@ import (
5 5
 	"net/url"
6 6
 )
7 7
 
8
-type NodeUpdateResult struct {
9
-}
8
+type NodeUpdateResult struct{}
10 9
 
11 10
 // NodeUpdate updates a Node.
12 11
 func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, options NodeUpdateOptions) (NodeUpdateResult, error) {
... ...
@@ -195,7 +195,7 @@ type JSONMessagesStream iter.Seq2[JSONMessage, error]
195 195
 // each [JSONMessage] to out.
196 196
 // see DisplayJSONMessages for details
197 197
 func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
198
-	var dec = json.NewDecoder(in)
198
+	dec := json.NewDecoder(in)
199 199
 	var f JSONMessagesStream = func(yield func(JSONMessage, error) bool) {
200 200
 		for {
201 201
 			var jm JSONMessage
... ...
@@ -229,7 +229,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
229 229
 //     called if a JSONMessage contains an Aux field, in which case
230 230
 //     DisplayJSONMessagesStream does not present the JSONMessage.
231 231
 func DisplayJSONMessages(messages JSONMessagesStream, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
232
-	var ids = make(map[string]uint)
232
+	ids := make(map[string]uint)
233 233
 
234 234
 	for jm, err := range messages {
235 235
 		var diff uint
... ...
@@ -1,5 +1,4 @@
1 1
 package client
2 2
 
3 3
 // NodeInspectOptions holds parameters to inspect nodes with.
4
-type NodeInspectOptions struct {
5
-}
4
+type NodeInspectOptions struct{}