From c1a57ca199596255e8450621180d3cf1097c8a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 2 Feb 2023 21:34:31 +0100 Subject: [PATCH] Pre-allocate an array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit golangci-lint linter: prealloc Signed-off-by: Miloslav Trmač --- cmd/skopeo/proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/skopeo/proxy.go b/cmd/skopeo/proxy.go index eb819acd..d15f3ee7 100644 --- a/cmd/skopeo/proxy.go +++ b/cmd/skopeo/proxy.go @@ -668,7 +668,7 @@ func (h *proxyHandler) GetLayerInfo(args []any) (replyBuf, error) { layerInfos = img.LayerInfos() } - var layers []convertedLayerInfo + layers := make([]convertedLayerInfo, 0, len(layerInfos)) for _, layer := range layerInfos { layers = append(layers, convertedLayerInfo{layer.Digest, layer.Size, layer.MediaType}) }