From a2d3f8c87b69583dc2b859464039fb559b0c5cca Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Thu, 21 Sep 2023 06:21:13 +0000 Subject: [PATCH] fix race Signed-off-by: Billy Zha --- cmd/oras/internal/display/progress/manager.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/oras/internal/display/progress/manager.go b/cmd/oras/internal/display/progress/manager.go index c0f500df7..e0247e5dd 100644 --- a/cmd/oras/internal/display/progress/manager.go +++ b/cmd/oras/internal/display/progress/manager.go @@ -126,9 +126,8 @@ func (m *manager) newStatus(id int) Status { func (m *manager) update(ch chan *status, id int) { defer m.updating.Done() for s := range ch { - n := m.statuses[id].Update(s) m.rwLock.Lock() - m.statuses[id] = n + m.statuses[id] = m.statuses[id].Update(s) m.rwLock.Unlock() } }