Browse code

daemon/containerd: gofumpt

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

Sebastiaan van Stijn authored on 2024/06/28 06:13:25
Showing 8 changed files
... ...
@@ -44,7 +44,7 @@ func (c cacheAdaptor) Get(id image.ID) (*image.Image, error) {
44 44
 		return nil, fmt.Errorf("resolveImage: %w", err)
45 45
 	}
46 46
 
47
-	var errFound = errors.New("success")
47
+	errFound := errors.New("success")
48 48
 	err = c.is.walkImageManifests(ctx, c8dImg, func(img *ImageManifest) error {
49 49
 		desc, err := img.Config(ctx)
50 50
 		if err != nil {
... ...
@@ -13,7 +13,6 @@ import (
13 13
 // getImagesWithLabel returns all images that have the matching label key and value.
14 14
 func (i *ImageService) getImagesWithLabel(ctx context.Context, labelKey string, labelValue string) ([]image.ID, error) {
15 15
 	imgs, err := i.images.List(ctx, "labels."+labelKey+"=="+labelValue)
16
-
17 16
 	if err != nil {
18 17
 		return []image.ID{}, errdefs.System(errors.Wrap(err, "failed to list all images"))
19 18
 	}
... ...
@@ -254,7 +254,6 @@ func TestImageDelete(t *testing.T) {
254 254
 			}
255 255
 		})
256 256
 	}
257
-
258 257
 }
259 258
 
260 259
 type testContainerStore struct{}
... ...
@@ -131,7 +131,6 @@ func (i *ImageService) ExportImage(ctx context.Context, names []string, outStrea
131 131
 
132 132
 		for _, img := range imgs {
133 133
 			ref, err := reference.ParseNamed(img.Name)
134
-
135 134
 			if err != nil {
136 135
 				log.G(ctx).WithFields(log.Fields{
137 136
 					"image": img.Name,
... ...
@@ -299,7 +298,6 @@ func (i *ImageService) LoadImage(ctx context.Context, inTar io.ReadCloser, outSt
299 299
 
300 300
 			if !unpacked {
301 301
 				err = platformImg.Unpack(ctx, i.snapshotter)
302
-
303 302
 				if err != nil {
304 303
 					return errdefs.System(err)
305 304
 				}
... ...
@@ -209,7 +209,6 @@ func (i *ImageService) Images(ctx context.Context, opts imagetypes.ListOptions)
209 209
 func (i *ImageService) imageSummary(ctx context.Context, img images.Image, platformMatcher platforms.MatchComparer,
210 210
 	opts imagetypes.ListOptions, tagsByDigest map[digest.Digest][]string,
211 211
 ) (_ *imagetypes.Summary, allChainIDs []digest.Digest, _ error) {
212
-
213 212
 	// Total size of the image including all its platform
214 213
 	var totalSize int64
215 214
 
... ...
@@ -192,7 +192,6 @@ func TestImageList(t *testing.T) {
192 192
 			tc.check(t, all)
193 193
 		})
194 194
 	}
195
-
196 195
 }
197 196
 
198 197
 func fakeImageService(t testing.TB, ctx context.Context, cs content.Store) *ImageService {
... ...
@@ -267,7 +267,6 @@ func desc(size int64) ocispec.Descriptor {
267 267
 		Size:      size,
268 268
 		MediaType: ocispec.MediaTypeImageIndex,
269 269
 	}
270
-
271 270
 }
272 271
 
273 272
 func digestFor(i int64) digest.Digest {
... ...
@@ -284,7 +283,7 @@ func newTestDB(ctx context.Context, t testing.TB) *metadata.DB {
284 284
 	t.Helper()
285 285
 
286 286
 	p := filepath.Join(t.TempDir(), "metadata")
287
-	bdb, err := bbolt.Open(p, 0600, &bbolt.Options{})
287
+	bdb, err := bbolt.Open(p, 0o600, &bbolt.Options{})
288 288
 	if err != nil {
289 289
 		t.Fatal(err)
290 290
 	}
... ...
@@ -23,7 +23,6 @@ func (i *ImageService) softImageDelete(ctx context.Context, img containerdimages
23 23
 	// Create dangling image if this is the last image pointing to this target.
24 24
 	if len(imgs) == 1 {
25 25
 		err := i.ensureDanglingImage(context.WithoutCancel(ctx), img)
26
-
27 26
 		// Error out in case we couldn't persist the old image.
28 27
 		if err != nil {
29 28
 			return errdefs.System(errors.Wrapf(err, "failed to create a dangling image for the replaced image %s with digest %s",