Skip to content

Commit

Permalink
refactor: don't use init fn
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin committed Jun 17, 2024
1 parent 19e9979 commit 9d2240a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/iac/rego/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ var checkTypesWithSubtype = map[types.Source]struct{}{
types.SourceKubernetes: {},
}

var supportedProviders map[string]struct{}
var supportedProviders = makeSupportedProviders()

func init() {
supportedProviders = make(map[string]struct{})
func makeSupportedProviders() map[string]struct{} {
m := make(map[string]struct{})
for _, p := range providers.AllProviders() {
supportedProviders[string(p)] = struct{}{}
m[string(p)] = struct{}{}
}
supportedProviders["kind"] = struct{}{} // kubernetes
m["kind"] = struct{}{} // kubernetes
return m
}

var _ options.ConfigurableScanner = (*Scanner)(nil)
Expand Down

0 comments on commit 9d2240a

Please sign in to comment.