From 41493b0fade0fd0c1651596d6e577e79b3a15a61 Mon Sep 17 00:00:00 2001 From: lixiaobing10051267 Date: Tue, 27 Jun 2017 14:47:15 +0800 Subject: [PATCH] optimize for loop with rootfs.DiffIDs Signed-off-by: lixiaobing10051267 Upstream-commit: 80b2c326de29552c6ee4072fca75ae00eb3be41a Component: engine --- components/engine/distribution/push_v2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/distribution/push_v2.go b/components/engine/distribution/push_v2.go index 504083367e..ffc7d68107 100644 --- a/components/engine/distribution/push_v2.go +++ b/components/engine/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. - for i := 0; i < len(rootfs.DiffIDs); i++ { + for range rootfs.DiffIDs { descriptor := descriptorTemplate descriptor.layer = l descriptor.checkedDigests = make(map[digest.Digest]struct{})