From 5d7b1557cc10c0559bd1547544b25c467d4a5244 Mon Sep 17 00:00:00 2001 From: Simar Date: Mon, 8 Jan 2024 22:57:05 -0700 Subject: [PATCH] fix lint --- pkg/rego/metadata.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/rego/metadata.go b/pkg/rego/metadata.go index c37b6993c..6873dee02 100644 --- a/pkg/rego/metadata.go +++ b/pkg/rego/metadata.go @@ -100,13 +100,7 @@ func (sm *StaticMetadata) Update(meta map[string]any) error { } } - if raw, ok := meta["aliases"]; ok { - if aliases, ok := raw.([]interface{}); ok { - for _, a := range aliases { - sm.Aliases = append(sm.Aliases, fmt.Sprintf("%s", a)) - } - } - } + sm.updateAliases(meta) var err error if sm.CloudFormation, err = NewEngineMetadata("cloud_formation", meta); err != nil { @@ -120,6 +114,16 @@ func (sm *StaticMetadata) Update(meta map[string]any) error { return nil } +func (sm *StaticMetadata) updateAliases(meta map[string]any) { + if raw, ok := meta["aliases"]; ok { + if aliases, ok := raw.([]interface{}); ok { + for _, a := range aliases { + sm.Aliases = append(sm.Aliases, fmt.Sprintf("%s", a)) + } + } + } +} + func (sm *StaticMetadata) FromAnnotations(annotations *ast.Annotations) error { sm.Title = annotations.Title sm.Description = annotations.Description