From 958e7e615d07fd26f9469b940e1c3c82713b89e6 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Thu, 18 Jul 2024 08:43:34 -0600 Subject: [PATCH] fix: variable name conflicts with built in function Signed-off-by: Terry Howe --- cmd/oras/internal/display/status/progress/manager.go | 12 ++++++------ .../internal/display/status/progress/status_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/oras/internal/display/status/progress/manager.go b/cmd/oras/internal/display/status/progress/manager.go index 09929156a..85f39580f 100644 --- a/cmd/oras/internal/display/status/progress/manager.go +++ b/cmd/oras/internal/display/status/progress/manager.go @@ -92,17 +92,17 @@ func (m *manager) render() { defer m.statusLock.RUnlock() // todo: update size in another routine width, height := m.console.Size() - len := len(m.status) * 2 + statusLength := len(m.status) * 2 offset := 0 - if len > height { + if statusLength > height { // skip statuses that cannot be rendered - offset = len - height + offset = statusLength - height } - for ; offset < len; offset += 2 { + for ; offset < statusLength; offset += 2 { status, progress := m.status[offset/2].String(width) - m.console.OutputTo(uint(len-offset), status) - m.console.OutputTo(uint(len-offset-1), progress) + m.console.OutputTo(uint(statusLength-offset), status) + m.console.OutputTo(uint(statusLength-offset-1), progress) } } diff --git a/cmd/oras/internal/display/status/progress/status_test.go b/cmd/oras/internal/display/status/progress/status_test.go index 417ffb45e..e0b3bb912 100644 --- a/cmd/oras/internal/display/status/progress/status_test.go +++ b/cmd/oras/internal/display/status/progress/status_test.go @@ -68,7 +68,7 @@ func Test_status_String(t *testing.T) { } } -func Test_status_String_zeroWitdth(t *testing.T) { +func Test_status_String_zeroWidth(t *testing.T) { // zero status and progress s := newStatus() if status, digest := s.String(console.MinWidth); status != zeroStatus || digest != zeroDigest {