From 9098320c63350f44d07c86da3c071331c2556bf3 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Mon, 13 Jan 2025 11:02:21 +0100 Subject: [PATCH] Fix linter messages --- bundle/config/mutator/process_target_mode.go | 4 ++-- libs/diag/diagnostic.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bundle/config/mutator/process_target_mode.go b/bundle/config/mutator/process_target_mode.go index cc07704bf..0fe6bd54f 100644 --- a/bundle/config/mutator/process_target_mode.go +++ b/bundle/config/mutator/process_target_mode.go @@ -159,9 +159,9 @@ func validateProductionMode(ctx context.Context, b *bundle.Bundle, isPrincipalUs // and neither is setting a principal. // We only show a warning for these cases since we didn't historically // report an error for them. - return diag.Recommendation("target with 'mode: production' should " + advice) + return diag.Recommendationf("target with 'mode: production' should %s", advice) } - return diag.Errorf("target with 'mode: production' must " + advice) + return diag.Errorf("target with 'mode: production' must %s", advice) } return nil } diff --git a/libs/diag/diagnostic.go b/libs/diag/diagnostic.go index a4f8c7b6b..0c7699b4e 100644 --- a/libs/diag/diagnostic.go +++ b/libs/diag/diagnostic.go @@ -86,6 +86,16 @@ func Infof(format string, args ...any) Diagnostics { } } +// Recommendationf creates a new recommendation diagnostic. +func Recommendationf(format string, args ...any) Diagnostics { + return []Diagnostic{ + { + Severity: Recommendation, + Summary: fmt.Sprintf(format, args...), + }, + } +} + // Diagnostics holds zero or more instances of [Diagnostic]. type Diagnostics []Diagnostic