Skip to content

Commit 69d3d44

Browse files
committed
lint: add unconvert
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
1 parent 7e96e62 commit 69d3d44

File tree

26 files changed

+53
-51
lines changed

26 files changed

+53
-51
lines changed

cache/blobs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ func (sr *immutableRef) computeChainMetadata(ctx context.Context, filter map[str
351351
}
352352
diffID := sr.getDiffID()
353353
chainID = diffID
354-
blobChainID = imagespecidentity.ChainID([]digest.Digest{digest.Digest(sr.getBlob()), diffID})
354+
blobChainID = imagespecidentity.ChainID([]digest.Digest{sr.getBlob(), diffID})
355355
case Layer:
356356
if _, ok := filter[sr.ID()]; !ok {
357357
return nil
@@ -368,9 +368,9 @@ func (sr *immutableRef) computeChainMetadata(ctx context.Context, filter map[str
368368
return errors.Errorf("failed to set blobchain for reference with non-addressable parent %q", sr.layerParent.GetDescription())
369369
}
370370
}
371-
diffID := digest.Digest(sr.getDiffID())
371+
diffID := sr.getDiffID()
372372
chainID = imagespecidentity.ChainID([]digest.Digest{chainID, diffID})
373-
blobID := imagespecidentity.ChainID([]digest.Digest{digest.Digest(sr.getBlob()), diffID})
373+
blobID := imagespecidentity.ChainID([]digest.Digest{sr.getBlob(), diffID})
374374
blobChainID = imagespecidentity.ChainID([]digest.Digest{blobChainID, blobID})
375375
case Merge:
376376
baseInput := sr.mergeParents[0]
@@ -386,9 +386,9 @@ func (sr *immutableRef) computeChainMetadata(ctx context.Context, filter map[str
386386
// not enough information to compute chain at this time
387387
return nil
388388
}
389-
diffID := digest.Digest(layer.getDiffID())
389+
diffID := layer.getDiffID()
390390
chainID = imagespecidentity.ChainID([]digest.Digest{chainID, diffID})
391-
blobID := imagespecidentity.ChainID([]digest.Digest{digest.Digest(layer.getBlob()), diffID})
391+
blobID := imagespecidentity.ChainID([]digest.Digest{layer.getBlob(), diffID})
392392
blobChainID = imagespecidentity.ChainID([]digest.Digest{blobChainID, blobID})
393393
}
394394
}
@@ -397,7 +397,7 @@ func (sr *immutableRef) computeChainMetadata(ctx context.Context, filter map[str
397397
// this diff is its own blob
398398
diffID := sr.getDiffID()
399399
chainID = diffID
400-
blobChainID = imagespecidentity.ChainID([]digest.Digest{digest.Digest(sr.getBlob()), diffID})
400+
blobChainID = imagespecidentity.ChainID([]digest.Digest{sr.getBlob(), diffID})
401401
} else {
402402
// re-using upper blob
403403
chainID = sr.diffParents.upper.getChainID()

cache/contenthash/checksum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func (cc *cacheContext) HandleChange(kind fsutil.ChangeKind, p string, fi os.Fil
399399
for _, l := range links {
400400
pp := convertKeyToPath(l)
401401
cc.txn.Insert(l, cr)
402-
d := path.Dir(string(pp))
402+
d := path.Dir(pp)
403403
if d == "/" {
404404
d = ""
405405
}

cache/manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,7 @@ func mapToSystemTarBlob(t *testing.T, m map[string]string) ([]byte, ocispecs.Des
28072807
if err != nil {
28082808
return nil, ocispecs.Descriptor{}, err
28092809
}
2810-
if string(gotV) != string(v) {
2810+
if string(gotV) != v {
28112811
return nil, ocispecs.Descriptor{}, errors.Errorf("unexpected contents of %s", h.Name)
28122812
}
28132813
}

cache/migrate_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func MigrateV2(ctx context.Context, from, to string, cs content.Store, s snapsho
223223

224224
if blob := md.getBlob(); blob != "" {
225225
if _, err := cs.Update(ctx, content.Info{
226-
Digest: digest.Digest(blob),
226+
Digest: blob,
227227
}, "labels.containerd.io/gc.root"); err != nil {
228228
return err
229229
}

cache/refs.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ func (cr *cacheRecord) size(ctx context.Context) (int64, error) {
361361
}
362362
if dgst := cr.getBlob(); dgst != "" {
363363
added := make(map[digest.Digest]struct{})
364-
info, err := cr.cm.ContentStore.Info(ctx, digest.Digest(dgst))
364+
info, err := cr.cm.ContentStore.Info(ctx, dgst)
365365
if err == nil {
366366
usage.Size += info.Size
367-
added[digest.Digest(dgst)] = struct{}{}
367+
added[dgst] = struct{}{}
368368
}
369-
walkBlobVariantsOnly(ctx, cr.cm.ContentStore, digest.Digest(dgst), func(desc ocispecs.Descriptor) bool {
369+
walkBlobVariantsOnly(ctx, cr.cm.ContentStore, dgst, func(desc ocispecs.Descriptor) bool {
370370
if _, ok := added[desc.Digest]; !ok {
371371
if info, err := cr.cm.ContentStore.Info(ctx, desc.Digest); err == nil {
372372
usage.Size += info.Size
@@ -1035,7 +1035,7 @@ func (sr *immutableRef) withRemoteSnapshotLabelsStargzMode(ctx context.Context,
10351035
} else if _, ok := info.Labels["containerd.io/snapshot/remote"]; !ok {
10361036
continue // This isn't a remote snapshot; skip
10371037
}
1038-
dh := dhs[digest.Digest(r.getBlob())]
1038+
dh := dhs[r.getBlob()]
10391039
if dh == nil {
10401040
continue // no info passed; skip
10411041
}
@@ -1075,7 +1075,7 @@ func (sr *immutableRef) prepareRemoteSnapshotsStargzMode(ctx context.Context, s
10751075
continue
10761076
}
10771077

1078-
dh := dhs[digest.Digest(r.getBlob())]
1078+
dh := dhs[r.getBlob()]
10791079
if dh == nil {
10801080
// We cannot prepare remote snapshots without descHandler.
10811081
return nil, nil

client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11423,7 +11423,7 @@ func testLLBMountPerformance(t *testing.T, sb integration.Sandbox) {
1142311423
require.NoError(t, err)
1142411424

1142511425
// Windows images take longer time
11426-
timeout := integration.UnixOrWindows(time.Duration(time.Minute), time.Duration(3*time.Minute))
11426+
timeout := integration.UnixOrWindows(time.Minute, 3*time.Minute)
1142711427
timeoutCtx, cancel := context.WithTimeoutCause(sb.Context(), timeout, nil)
1142811428
defer cancel()
1142911429
_, err = c.Solve(timeoutCtx, def, SolveOpt{}, nil)

client/llb/definition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func (d *DefinitionOp) Inputs() []Output {
240240
d.mu.Unlock()
241241

242242
inputs = append(inputs, &output{vertex: vtx, platform: platform, getIndex: func() (pb.OutputIndex, error) {
243-
return pb.OutputIndex(vtx.index), nil
243+
return vtx.index, nil
244244
}})
245245
}
246246

client/prune.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti
1818
req := &controlapi.PruneRequest{
1919
Filter: info.Filter,
2020
KeepDuration: int64(info.KeepDuration),
21-
ReservedSpace: int64(info.ReservedSpace),
22-
MaxUsedSpace: int64(info.MaxUsedSpace),
23-
MinFreeSpace: int64(info.MinFreeSpace),
21+
ReservedSpace: info.ReservedSpace,
22+
MaxUsedSpace: info.MaxUsedSpace,
23+
MinFreeSpace: info.MinFreeSpace,
2424
}
2525
if info.All {
2626
req.All = true

client/solve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
356356
return nil, err
357357
}
358358
var manifestDesc ocispecs.Descriptor
359-
if err = json.Unmarshal([]byte(manifestDescDt), &manifestDesc); err != nil {
359+
if err = json.Unmarshal(manifestDescDt, &manifestDesc); err != nil {
360360
return nil, err
361361
}
362362
for _, storePath := range storesToUpdate {

executor/resources/sampler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (s *Sampler[T]) run() {
122122
ss.err = nil
123123
}
124124
dur := ss.last.Sub(ss.first)
125-
if time.Duration(ss.interval)*time.Duration(s.maxSamples) <= dur {
125+
if ss.interval*time.Duration(s.maxSamples) <= dur {
126126
ss.interval *= 2
127127
}
128128
}

0 commit comments

Comments
 (0)