Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
simar7 committed Jan 9, 2024
1 parent 809e213 commit 5d7b155
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pkg/rego/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 5d7b155

Please sign in to comment.