From b68114375fea9b1e73b62a3f3955e291c1d1eb03 Mon Sep 17 00:00:00 2001 From: Felix de Souza Date: Mon, 14 Nov 2022 17:58:15 +0000 Subject: [PATCH] Address feedback Signed-off-by: Felix de Souza --- util/imagetools/printers.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/imagetools/printers.go b/util/imagetools/printers.go index a57654d9..1d362819 100644 --- a/util/imagetools/printers.go +++ b/util/imagetools/printers.go @@ -113,8 +113,9 @@ func (p *Printer) Print(raw bool, out io.Writer) error { } imageconfigs := make(map[string]*ocispecs.Image) + imageconfigsMutex := sync.Mutex{} buildinfos := make(map[string]*binfotypes.BuildInfo) - mutex := &sync.RWMutex{} + buildinfosMutex := sync.Mutex{} eg, _ := errgroup.WithContext(p.ctx) for _, platform := range p.platforms { @@ -124,16 +125,16 @@ func (p *Printer) Print(raw bool, out io.Writer) error { if err != nil { return err } else if img != nil { - mutex.Lock() + imageconfigsMutex.Lock() imageconfigs[platforms.Format(platform)] = img - mutex.Unlock() + imageconfigsMutex.Unlock() } if bi, err := imageutil.BuildInfo(dtic); err != nil { return err } else if bi != nil { - mutex.Lock() + buildinfosMutex.Lock() buildinfos[platforms.Format(platform)] = bi - mutex.Unlock() + buildinfosMutex.Unlock() } return nil })