From c8baec74c0ef28bb14532a4576096165f3cd7c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 10 May 2022 16:05:27 +0200 Subject: [PATCH] Ensure stable presentation of FORBIDDEN errors --- pkg/cmd/status/status.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/status/status.go b/pkg/cmd/status/status.go index 45c3bde77..9aaefdf9c 100644 --- a/pkg/cmd/status/status.go +++ b/pkg/cmd/status/status.go @@ -594,9 +594,10 @@ func (s *StatusGetter) addAuthError(msg, ssoURL string) { s.authErrors = set.NewStringSet() } - s.authErrors.Add(msg) if ssoURL != "" { - s.authErrors.Add(fmt.Sprintf("Authorize in your web browser: %s", ssoURL)) + s.authErrors.Add(fmt.Sprintf("%s\nAuthorize in your web browser: %s", msg, ssoURL)) + } else { + s.authErrors.Add(msg) } } @@ -725,7 +726,9 @@ func statusRun(opts *StatusOptions) error { fmt.Fprintln(out, raSection) if sg.HasAuthErrors() { - for _, msg := range sg.authErrors.ToSlice() { + errs := sg.authErrors.ToSlice() + sort.Strings(errs) + for _, msg := range errs { fmt.Fprintln(out, cs.Gray(fmt.Sprintf("warning: %s", msg))) } }