From e199e19c75cf067f2b77083b30d961ca3772bd01 Mon Sep 17 00:00:00 2001 From: mitchell Date: Thu, 2 Nov 2023 18:05:57 -0400 Subject: [PATCH] Reduce nesting. --- pkg/cmdlets/errors/errors.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/cmdlets/errors/errors.go b/pkg/cmdlets/errors/errors.go index a9df454d0d..108eab2424 100644 --- a/pkg/cmdlets/errors/errors.go +++ b/pkg/cmdlets/errors/errors.go @@ -85,12 +85,15 @@ func (o *OutputError) MarshalOutput(f output.Format) interface{} { func getErrorTips(err error) []string { errorTips := []string{} for _, err := range errs.Unpack(err) { - if v, ok := err.(ErrorTips); ok { - for _, tip := range v.ErrorTips() { - if !funk.Contains(errorTips, tip) { - errorTips = append(errorTips, tip) - } + v, ok := err.(ErrorTips) + if !ok { + continue + } + for _, tip := range v.ErrorTips() { + if funk.Contains(errorTips, tip) { + continue } + errorTips = append(errorTips, tip) } } return errorTips