Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Felix de Souza <[email protected]>
  • Loading branch information
felixdesouza committed Nov 14, 2022
1 parent 83a09b3 commit b681143
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions util/imagetools/printers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
})
Expand Down

0 comments on commit b681143

Please sign in to comment.