Ver Fonte

optimize for loop with rootfs.DiffIDs

Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
lixiaobing10051267 há 8 anos atrás
pai
commit
80b2c326de
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      distribution/push_v2.go

+ 1 - 1
distribution/push_v2.go

@@ -147,7 +147,7 @@ func (p *v2Pusher) pushV2Tag(ctx context.Context, ref reference.NamedTagged, id
 	}
 	}
 
 
 	// Loop bounds condition is to avoid pushing the base layer on Windows.
 	// Loop bounds condition is to avoid pushing the base layer on Windows.
-	for i := 0; i < len(rootfs.DiffIDs); i++ {
+	for range rootfs.DiffIDs {
 		descriptor := descriptorTemplate
 		descriptor := descriptorTemplate
 		descriptor.layer = l
 		descriptor.layer = l
 		descriptor.checkedDigests = make(map[digest.Digest]struct{})
 		descriptor.checkedDigests = make(map[digest.Digest]struct{})