Browse code

Merge pull request #51100 from thaJeztah/linty_nits

daemon/images: minor linting fixes

Sebastiaan van Stijn authored on 2025/10/06 21:50:31
Showing 1 changed files
... ...
@@ -70,9 +70,8 @@ func (i *ImageService) Images(ctx context.Context, opts imagebackend.ListOptions
70 70
 		if err != nil {
71 71
 			return err
72 72
 		}
73
-		timestamp := time.Unix(seconds, nanoseconds)
74
-		if beforeFilter.IsZero() || beforeFilter.After(timestamp) {
75
-			beforeFilter = timestamp
73
+		if tsUnix := time.Unix(seconds, nanoseconds); beforeFilter.IsZero() || beforeFilter.After(tsUnix) {
74
+			beforeFilter = tsUnix
76 75
 		}
77 76
 		return nil
78 77
 	})
... ...
@@ -134,7 +133,7 @@ func (i *ImageService) Images(ctx context.Context, opts imagebackend.ListOptions
134 134
 		}
135 135
 
136 136
 		// Skip any images with an unsupported operating system to avoid a potential
137
-		// panic when indexing through the layerstore. Don't error as we want to list
137
+		// panic when indexing through the layerStore. Don't error as we want to list
138 138
 		// the other images. This should never happen, but here as a safety precaution.
139 139
 		if err := image.CheckOS(img.OperatingSystem()); err != nil {
140 140
 			continue
... ...
@@ -246,13 +245,13 @@ func (i *ImageService) Images(ctx context.Context, opts imagebackend.ListOptions
246 246
 			summary.SharedSize = 0
247 247
 			for _, id := range img.RootFS.DiffIDs {
248 248
 				rootFS.Append(id)
249
-				chid := rootFS.ChainID()
249
+				chID := rootFS.ChainID()
250 250
 
251
-				if layerRefs[chid] > 1 {
252
-					if _, ok := allLayers[chid]; !ok {
253
-						return nil, fmt.Errorf("layer %v was not found (corruption?)", chid)
251
+				if layerRefs[chID] > 1 {
252
+					if _, ok := allLayers[chID]; !ok {
253
+						return nil, fmt.Errorf("layer %v was not found (corruption?)", chID)
254 254
 					}
255
-					summary.SharedSize += allLayers[chid].DiffSize()
255
+					summary.SharedSize += allLayers[chID].DiffSize()
256 256
 				}
257 257
 			}
258 258
 		}
... ...
@@ -274,7 +273,7 @@ func newImageSummary(image *image.Image, size int64) *imagetypes.Summary {
274 274
 		Created:  created,
275 275
 		Size:     size,
276 276
 		// -1 indicates that the value has not been set (avoids ambiguity
277
-		// between 0 (default) and "not set". We cannot use a pointer (nil)
277
+		// between 0 (default) and "not set"). We cannot use a pointer (nil)
278 278
 		// for this, as the JSON representation uses "omitempty", which would
279 279
 		// consider both "0" and "nil" to be "empty".
280 280
 		SharedSize: -1,