diff --git a/internal/commands/parse.go b/internal/commands/parse.go index bbcb0e4cf..9ad35fe7b 100644 --- a/internal/commands/parse.go +++ b/internal/commands/parse.go @@ -43,7 +43,7 @@ func NewParseCommand() *cobra.Command { return nil }, RunE: func(_ *cobra.Command, files []string) error { - var configurations map[string]interface{} + var configurations map[string]any var err error if viper.GetString("parser") != "" { configurations, err = parser.ParseConfigurationsAs(files, viper.GetString("parser")) @@ -77,11 +77,11 @@ func NewParseCommand() *cobra.Command { return &cmd } -func formatSingleJSON(configurations map[string]interface{}) (string, error) { +func formatSingleJSON(configurations map[string]any) (string, error) { if len(configurations) != 1 { return "", fmt.Errorf("formatSingleJSON: only supports one configuration") } - var config interface{} + var config any for _, cfg := range configurations { config = cfg } diff --git a/output/result.go b/output/result.go index 2c56be473..494c914da 100644 --- a/output/result.go +++ b/output/result.go @@ -4,14 +4,14 @@ import "fmt" // Result describes the result of a single rule evaluation. type Result struct { - Message string `json:"msg"` - Metadata map[string]interface{} `json:"metadata,omitempty"` - Outputs []string `json:"outputs,omitempty"` + Message string `json:"msg"` + Metadata map[string]any `json:"metadata,omitempty"` + Outputs []string `json:"outputs,omitempty"` } // NewResult creates a new result. An error is returned if the // metadata could not be successfully parsed. -func NewResult(metadata map[string]interface{}) (Result, error) { +func NewResult(metadata map[string]any) (Result, error) { if _, ok := metadata["msg"]; !ok { return Result{}, fmt.Errorf("rule missing msg field: %v", metadata) } @@ -21,7 +21,7 @@ func NewResult(metadata map[string]interface{}) (Result, error) { result := Result{ Message: metadata["msg"].(string), - Metadata: make(map[string]interface{}), + Metadata: make(map[string]any), } for k, v := range metadata { diff --git a/output/sarif.go b/output/sarif.go index c3533d218..41c3eafb7 100644 --- a/output/sarif.go +++ b/output/sarif.go @@ -149,7 +149,7 @@ func (s *SARIF) Output(results []CheckResult) error { if hasSuccesses { statusResult := Result{ Message: successDesc, - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "description": successDesc, }, } @@ -157,7 +157,7 @@ func (s *SARIF) Output(results []CheckResult) error { } else { statusResult := Result{ Message: skippedDesc, - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "description": skippedDesc, }, } diff --git a/output/sarif_test.go b/output/sarif_test.go index 25165843e..5a4a4904c 100644 --- a/output/sarif_test.go +++ b/output/sarif_test.go @@ -51,7 +51,7 @@ func TestSARIF_Output(t *testing.T) { Failures: []Result{ { Message: "test failure", - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "package": "test", "rule": "rule1", }, @@ -121,7 +121,7 @@ func TestSARIF_Output(t *testing.T) { Warnings: []Result{ { Message: "test warning", - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "foo": "bar", }, }, @@ -189,7 +189,7 @@ func TestSARIF_Output(t *testing.T) { Exceptions: []Result{ { Message: "test exception", - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "description": "test exception description", }, }, @@ -344,14 +344,14 @@ func TestSARIF_Output(t *testing.T) { Failures: []Result{ { Message: "test failure 1", - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "package": "test", "rule": "rule1", }, }, { Message: "test failure 2", - Metadata: map[string]interface{}{ + Metadata: map[string]any{ "package": "test", "rule": "rule1", }, @@ -575,7 +575,7 @@ func TestSARIF_Report(t *testing.T) { // JSON strings are normalised to their canonical form without whitespace. func compareJSON(t *testing.T, got, want string) { t.Helper() - var gotJSON, wantJSON interface{} + var gotJSON, wantJSON any if err := json.Unmarshal([]byte(got), &gotJSON); err != nil { t.Fatalf("failed to unmarshal actual JSON: %v", err) } diff --git a/parser/cue/cue.go b/parser/cue/cue.go index 815a70941..da0b37db2 100644 --- a/parser/cue/cue.go +++ b/parser/cue/cue.go @@ -12,7 +12,7 @@ import ( type Parser struct{} // Unmarshal unmarshals CUE files. -func (*Parser) Unmarshal(p []byte, v interface{}) error { +func (*Parser) Unmarshal(p []byte, v any) error { out, err := cformat.Source(p) if err != nil { return fmt.Errorf("format cue: %w", err) diff --git a/parser/cue/cue_test.go b/parser/cue/cue_test.go index b3c236cc0..f511603e5 100644 --- a/parser/cue/cue_test.go +++ b/parser/cue/cue_test.go @@ -25,7 +25,7 @@ func TestCueParser(t *testing.T) { parser := &Parser{} - var input interface{} + var input any if err := parser.Unmarshal([]byte(p), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -34,7 +34,7 @@ func TestCueParser(t *testing.T) { t.Error("There should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) kind := inputMap["kind"] if kind != "Deployment" { t.Error("Parsed cuelang file should be a deployment, but was not") diff --git a/parser/cyclonedx/cyclonedx.go b/parser/cyclonedx/cyclonedx.go index c71c5d009..656365713 100644 --- a/parser/cyclonedx/cyclonedx.go +++ b/parser/cyclonedx/cyclonedx.go @@ -13,7 +13,7 @@ import ( type Parser struct{} // Unmarshal unmarshals CycloneDX files. -func (*Parser) Unmarshal(p []byte, v interface{}) error { +func (*Parser) Unmarshal(p []byte, v any) error { bomFileFormat := cyclonedx.BOMFileFormatJSON if !json.Valid(p) { bomFileFormat = cyclonedx.BOMFileFormatXML diff --git a/parser/cyclonedx/cyclonedx_test.go b/parser/cyclonedx/cyclonedx_test.go index 2df9b59f5..85def7b9a 100644 --- a/parser/cyclonedx/cyclonedx_test.go +++ b/parser/cyclonedx/cyclonedx_test.go @@ -40,7 +40,7 @@ func TestCycloneDXParserValid(t *testing.T) { parser := &Parser{} - var input interface{} + var input any if err := parser.Unmarshal([]byte(sbom), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -52,9 +52,9 @@ func TestCycloneDXParserValid(t *testing.T) { //#nosec until https://github.com/securego/gosec/issues/1001 is fixed expectedSHA256 := "sha256:d7ec60cf8390612b360c857688b383068b580d9a6ab78417c9493170ad3f1616" - metadata := input.(map[string]interface{})["metadata"] - component := metadata.(map[string]interface{})["component"] - currentSHA256 := component.(map[string]interface{})["version"] + metadata := input.(map[string]any)["metadata"] + component := metadata.(map[string]any)["component"] + currentSHA256 := component.(map[string]any)["version"] if expectedSHA256 != currentSHA256 { t.Fatalf("current SHA256 %s is different from the expected SHA256 %s", currentSHA256, expectedSHA256) @@ -95,7 +95,7 @@ func TestCycloneDXParserInValid(t *testing.T) { parser := &Parser{} - var input interface{} + var input any if err := parser.Unmarshal([]byte(sbom), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -107,9 +107,9 @@ func TestCycloneDXParserInValid(t *testing.T) { //#nosec until https://github.com/securego/gosec/issues/1001 is fixed expectedSHA256 := "sha256:d7ec60cf8390612b360c857688b383068b580d9a6ab78417c9493170ad3f1616" - metadata := input.(map[string]interface{})["metadata"] - component := metadata.(map[string]interface{})["component"] - currentSHA256 := component.(map[string]interface{})["version"] + metadata := input.(map[string]any)["metadata"] + component := metadata.(map[string]any)["component"] + currentSHA256 := component.(map[string]any)["version"] var err error if expectedSHA256 != currentSHA256 { diff --git a/parser/docker/docker.go b/parser/docker/docker.go index c387378cb..5ad5f7e94 100644 --- a/parser/docker/docker.go +++ b/parser/docker/docker.go @@ -36,7 +36,7 @@ type Command struct { } // Unmarshal unmarshals Dockerfiles -func (dp *Parser) Unmarshal(p []byte, v interface{}) error { +func (dp *Parser) Unmarshal(p []byte, v any) error { r := bytes.NewReader(p) res, err := parser.Parse(r) if err != nil { diff --git a/parser/docker/docker_test.go b/parser/docker/docker_test.go index 8acdb3e1e..a70e07640 100644 --- a/parser/docker/docker_test.go +++ b/parser/docker/docker_test.go @@ -11,7 +11,7 @@ func TestParser_Unmarshal(t *testing.T) { COPY . / RUN echo hello` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -20,11 +20,11 @@ RUN echo hello` t.Error("there should be information parsed but its nil") } - dockerFile := input.([]interface{})[0] - commands := dockerFile.([]interface{})[0] + dockerFile := input.([]any)[0] + commands := dockerFile.([]any)[0] expected := "from" - actual := commands.(map[string]interface{})["Cmd"] + actual := commands.(map[string]any)["Cmd"] if actual != expected { t.Errorf("first Docker command should be '%v', was '%v'", expected, actual) @@ -44,7 +44,7 @@ COPY . . FROM base as builder RUN go build -o conftest` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -53,17 +53,17 @@ RUN go build -o conftest` t.Error("there should be information parsed but its nil") } - dockerFile := input.([]interface{})[0] - commands := dockerFile.([]interface{}) + dockerFile := input.([]any)[0] + commands := dockerFile.([]any) cmd := commands[1] - stage := cmd.(map[string]interface{})["Stage"].(float64) + stage := cmd.(map[string]any)["Stage"].(float64) if stage != 0 { t.Errorf("expected command to be in stage 0, not stage: %v", stage) } cmd = commands[6] - stage = cmd.(map[string]interface{})["Stage"].(float64) + stage = cmd.(map[string]any)["Stage"].(float64) if stage != 1 { t.Errorf("expected command to be in stage 1, not stage: %v", stage) } diff --git a/parser/dotenv/dotenv.go b/parser/dotenv/dotenv.go index 01d8d48b0..0abce055f 100644 --- a/parser/dotenv/dotenv.go +++ b/parser/dotenv/dotenv.go @@ -12,7 +12,7 @@ import ( type Parser struct{} // Unmarshal unmarshals dotenv files. -func (i *Parser) Unmarshal(p []byte, v interface{}) error { +func (i *Parser) Unmarshal(p []byte, v any) error { r := bytes.NewReader(p) cfg, err := gotenv.StrictParse(r) if err != nil { diff --git a/parser/dotenv/dotenv_test.go b/parser/dotenv/dotenv_test.go index 90d17de8e..dd8be5334 100644 --- a/parser/dotenv/dotenv_test.go +++ b/parser/dotenv/dotenv_test.go @@ -13,7 +13,7 @@ func TestDotenvParser(t *testing.T) { MYSQL_USER=root MYSQL_PASSWORD=root` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -22,7 +22,7 @@ func TestDotenvParser(t *testing.T) { t.Error("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) if len(inputMap) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } diff --git a/parser/edn/edn.go b/parser/edn/edn.go index f4f7f055d..a73d78859 100644 --- a/parser/edn/edn.go +++ b/parser/edn/edn.go @@ -10,39 +10,39 @@ import ( type Parser struct{} // Unmarshal unmarshals EDN encoded files. -func (tp *Parser) Unmarshal(p []byte, v interface{}) error { - var res interface{} +func (tp *Parser) Unmarshal(p []byte, v any) error { + var res any if err := edn.Unmarshal(p, &res); err != nil { return fmt.Errorf("unmarshal EDN: %w", err) } - *v.(*interface{}) = cleanupMapValue(res) + *v.(*any) = cleanupMapValue(res) return nil } -func cleanupInterfaceArray(in []interface{}) []interface{} { - res := make([]interface{}, len(in)) +func cleanupInterfaceArray(in []any) []any { + res := make([]any, len(in)) for i, v := range in { res[i] = cleanupMapValue(v) } return res } -func cleanupInterfaceMap(in map[interface{}]interface{}) map[string]interface{} { - res := make(map[string]interface{}) +func cleanupInterfaceMap(in map[any]any) map[string]any { + res := make(map[string]any) for k, v := range in { res[fmt.Sprintf("%v", k)] = cleanupMapValue(v) } return res } -func cleanupMapValue(v interface{}) interface{} { +func cleanupMapValue(v any) any { switch v := v.(type) { - case []interface{}: + case []any: return cleanupInterfaceArray(v) - case map[interface{}]interface{}: + case map[any]any: return cleanupInterfaceMap(v) case string: return v diff --git a/parser/edn/edn_test.go b/parser/edn/edn_test.go index d154c63ba..a8e931d14 100644 --- a/parser/edn/edn_test.go +++ b/parser/edn/edn_test.go @@ -11,12 +11,12 @@ func TestEDNParser(t *testing.T) { testTable := []struct { name string controlConfigs []byte - expectedResult interface{} + expectedResult any }{ { name: "a single config", controlConfigs: []byte(`{:sample true}`), - expectedResult: map[string]interface{}{ + expectedResult: map[string]any{ ":sample": "true", }, }, @@ -26,7 +26,7 @@ func TestEDNParser(t *testing.T) { :sample1 "my-username", :sample2 false, :sample3 5432}`), - expectedResult: map[string]interface{}{ + expectedResult: map[string]any{ ":sample1": "my-username", ":sample2": "false", ":sample3": "5432", @@ -36,7 +36,7 @@ func TestEDNParser(t *testing.T) { for _, test := range testTable { t.Run(test.name, func(t *testing.T) { - var unmarshalledConfigs interface{} + var unmarshalledConfigs any ednParser := new(edn.Parser) if err := ednParser.Unmarshal(test.controlConfigs, &unmarshalledConfigs); err != nil { diff --git a/parser/format.go b/parser/format.go index efa4ee762..fda48d110 100644 --- a/parser/format.go +++ b/parser/format.go @@ -7,7 +7,7 @@ import ( // Format takes in multiple configurations input and formats the configuration // to be more human readable. The key of each configuration should be its filepath. -func Format(configurations map[string]interface{}) (string, error) { +func Format(configurations map[string]any) (string, error) { var output string for file, config := range configurations { output += file + "\n" @@ -26,7 +26,7 @@ func Format(configurations map[string]interface{}) (string, error) { // FormatJSON takes in multiple configurations and formats them as a JSON // object where each key is the path to the file and the contents are the // parsed configurations. -func FormatJSON(configurations map[string]interface{}) (string, error) { +func FormatJSON(configurations map[string]any) (string, error) { marshaled, err := json.MarshalIndent(configurations, "", " ") if err != nil { return "", fmt.Errorf("marshal configs: %w", err) @@ -38,7 +38,7 @@ func FormatJSON(configurations map[string]interface{}) (string, error) { // FormatCombined takes in multiple configurations, combines them, and formats the // configuration to be more human readable. The key of each configuration should be // its filepath. -func FormatCombined(configurations map[string]interface{}) (string, error) { +func FormatCombined(configurations map[string]any) (string, error) { combinedConfigurations := CombineConfigurations(configurations) formattedConfigs, err := format(combinedConfigurations["Combined"]) @@ -49,7 +49,7 @@ func FormatCombined(configurations map[string]interface{}) (string, error) { return formattedConfigs, nil } -func format(configs interface{}) (string, error) { +func format(configs any) (string, error) { out, err := json.MarshalIndent(configs, "", "\t") if err != nil { return "", fmt.Errorf("marshal output to json: %w", err) diff --git a/parser/format_test.go b/parser/format_test.go index 4a7955cd3..515c69099 100644 --- a/parser/format_test.go +++ b/parser/format_test.go @@ -6,7 +6,7 @@ import ( ) func TestFormat(t *testing.T) { - configurations := make(map[string]interface{}) + configurations := make(map[string]any) config := struct { Property string }{ @@ -37,7 +37,7 @@ func TestFormat(t *testing.T) { } func TestFormatCombined(t *testing.T) { - configurations := make(map[string]interface{}) + configurations := make(map[string]any) config := struct { Sut string }{ diff --git a/parser/hcl1/hcl1.go b/parser/hcl1/hcl1.go index 2f46a3e9f..c5ab1f2ed 100644 --- a/parser/hcl1/hcl1.go +++ b/parser/hcl1/hcl1.go @@ -11,7 +11,7 @@ type Parser struct{} // Unmarshal unmarshals HCL files that are using version 1 of // the HCL language. -func (s *Parser) Unmarshal(p []byte, v interface{}) error { +func (s *Parser) Unmarshal(p []byte, v any) error { if err := hcl.Unmarshal(p, v); err != nil { return fmt.Errorf("unmarshal hcl: %w", err) } diff --git a/parser/hcl1/hcl1_test.go b/parser/hcl1/hcl1_test.go index 8f1647769..7ed77bca4 100644 --- a/parser/hcl1/hcl1_test.go +++ b/parser/hcl1/hcl1_test.go @@ -63,7 +63,7 @@ const sample = `provider "google" { }` func TestHcl1Parser(t *testing.T) { - var input interface{} + var input any parser := &Parser{} sampleFileBytes := []byte(sample) if err := parser.Unmarshal(sampleFileBytes, &input); err != nil { @@ -74,8 +74,8 @@ func TestHcl1Parser(t *testing.T) { t.Error("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) - if len(inputMap["resource"].([]map[string]interface{})) == 0 { + inputMap := input.(map[string]any) + if len(inputMap["resource"].([]map[string]any)) == 0 { t.Error("there should be resources defined in the parsed file, but none found") } } diff --git a/parser/hcl2/hcl2.go b/parser/hcl2/hcl2.go index 54f315f4d..7f2219bb3 100644 --- a/parser/hcl2/hcl2.go +++ b/parser/hcl2/hcl2.go @@ -12,7 +12,7 @@ type Parser struct{} // Unmarshal unmarshals HCL files that are written using // version 2 of the HCL language. -func (Parser) Unmarshal(p []byte, v interface{}) error { +func (Parser) Unmarshal(p []byte, v any) error { hclBytes, err := convert.Bytes(p, "", convert.Options{}) if err != nil { return fmt.Errorf("convert to bytes: %w", err) diff --git a/parser/hocon/hocon.go b/parser/hocon/hocon.go index a9d7eb5dd..41984848a 100644 --- a/parser/hocon/hocon.go +++ b/parser/hocon/hocon.go @@ -13,9 +13,9 @@ import ( type Parser struct{} // Unmarshal unmarshals HOCON files. -func (i *Parser) Unmarshal(p []byte, v interface{}) error { +func (i *Parser) Unmarshal(p []byte, v any) error { rootCfg := configuration.ParseString(string(p)) - result := make(map[string]interface{}) + result := make(map[string]any) for _, key := range rootCfg.Root().GetObject().GetKeys() { cfg := rootCfg.GetConfig(key) @@ -34,8 +34,8 @@ func (i *Parser) Unmarshal(p []byte, v interface{}) error { return nil } -func getConfig(rootCfg, cfg *configuration.Config, path string) map[string]interface{} { - result := make(map[string]interface{}) +func getConfig(rootCfg, cfg *configuration.Config, path string) map[string]any { + result := make(map[string]any) for _, key := range cfg.Root().GetObject().GetKeys() { tmpKey := path + "." + key @@ -50,7 +50,7 @@ func getConfig(rootCfg, cfg *configuration.Config, path string) map[string]inter return result } -func convertType(value *hocon.HoconValue) interface{} { +func convertType(value *hocon.HoconValue) any { str := value.String() switch { case isNumberLiteral(str): diff --git a/parser/hocon/hocon_test.go b/parser/hocon/hocon_test.go index a1fc8f840..062940438 100644 --- a/parser/hocon/hocon_test.go +++ b/parser/hocon/hocon_test.go @@ -17,7 +17,7 @@ func TestHoconUnmarshal(t *testing.T) { } }` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -26,9 +26,9 @@ func TestHoconUnmarshal(t *testing.T) { t.Error("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) item := inputMap["play"] - if len(item.(map[string]interface{})) == 0 { + if len(item.(map[string]any)) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } } diff --git a/parser/ignore/ignore.go b/parser/ignore/ignore.go index 8917dbd8a..ffa7b1631 100644 --- a/parser/ignore/ignore.go +++ b/parser/ignore/ignore.go @@ -11,7 +11,7 @@ import ( type Parser struct{} // Unmarshal unmarshals ignore files. -func (pp *Parser) Unmarshal(p []byte, v interface{}) error { +func (pp *Parser) Unmarshal(p []byte, v any) error { ignoreEntries, err := ignore.ParseIgnoreBytes(p) if err != nil { return fmt.Errorf("parse ignore bytes: %w", err) diff --git a/parser/ignore/ignore_test.go b/parser/ignore/ignore_test.go index 36ec0ddfa..444a1420a 100644 --- a/parser/ignore/ignore_test.go +++ b/parser/ignore/ignore_test.go @@ -11,7 +11,7 @@ func TestParser_Unmarshal(t *testing.T) { # Test` - var listOfEntryLists [][]interface{} + var listOfEntryLists [][]any if err := parser.Unmarshal([]byte(sample), &listOfEntryLists); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -34,21 +34,21 @@ func TestParser_Unmarshal(t *testing.T) { firstIgnoreEntry := input[0] expectedKind := "NegatedPath" - actualKind := firstIgnoreEntry.(map[string]interface{})["Kind"] + actualKind := firstIgnoreEntry.(map[string]any)["Kind"] if actualKind != expectedKind { t.Errorf("first ignore entry's Kind should be '%v', was '%v'", expectedKind, actualKind) } expectedValue := "bar" - actualValue := firstIgnoreEntry.(map[string]interface{})["Value"] + actualValue := firstIgnoreEntry.(map[string]any)["Value"] if actualValue != expectedValue { t.Errorf("first ignore entry's Value should be '%v', was '%v'", expectedValue, actualValue) } expectedOriginal := "!bar" - actualOriginal := firstIgnoreEntry.(map[string]interface{})["Original"] + actualOriginal := firstIgnoreEntry.(map[string]any)["Original"] if actualOriginal != expectedOriginal { t.Errorf("first ignore entry's Kind should be '%v', was '%v'", expectedOriginal, actualOriginal) diff --git a/parser/ini/ini.go b/parser/ini/ini.go index 950470ebc..c7752aa11 100644 --- a/parser/ini/ini.go +++ b/parser/ini/ini.go @@ -12,20 +12,20 @@ import ( type Parser struct{} // Unmarshal unmarshals INI files. -func (i *Parser) Unmarshal(p []byte, v interface{}) error { +func (i *Parser) Unmarshal(p []byte, v any) error { cfg, err := ini.Load(p) if err != nil { return fmt.Errorf("read ini file: %w", err) } - result := make(map[string]map[string]interface{}) + result := make(map[string]map[string]any) for _, s := range cfg.Sections() { sectionName := s.Name() if sectionName == "DEFAULT" { continue } - result[sectionName] = map[string]interface{}{} + result[sectionName] = map[string]any{} keysHash := s.KeysHash() result[sectionName] = convertKeyTypes(keysHash) } @@ -42,8 +42,8 @@ func (i *Parser) Unmarshal(p []byte, v interface{}) error { return nil } -func convertKeyTypes(keysHash map[string]string) map[string]interface{} { - val := map[string]interface{}{} +func convertKeyTypes(keysHash map[string]string) map[string]any { + val := map[string]any{} for k, v := range keysHash { switch { diff --git a/parser/ini/ini_test.go b/parser/ini/ini_test.go index 8ec72e13b..7a44baa5f 100644 --- a/parser/ini/ini_test.go +++ b/parser/ini/ini_test.go @@ -19,7 +19,7 @@ func TestIniParser(t *testing.T) { # Test comment` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -28,9 +28,9 @@ func TestIniParser(t *testing.T) { t.Error("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) item := inputMap["Local Variables"] - if len(item.(map[string]interface{})) == 0 { + if len(item.(map[string]any)) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } } @@ -39,7 +39,7 @@ func TestConvertTypes(t *testing.T) { testTable := []struct { name string input map[string]string - expectedOutput interface{} + expectedOutput any }{ {"Test number literal", map[string]string{"test": "3.0"}, 3.0}, {"Test string literal", map[string]string{"test": "conftest"}, "conftest"}, diff --git a/parser/json/json.go b/parser/json/json.go index acf2eb5d8..830c785b2 100644 --- a/parser/json/json.go +++ b/parser/json/json.go @@ -9,7 +9,7 @@ import ( type Parser struct{} // Unmarshal unmarshals JSON files. -func (p *Parser) Unmarshal(data []byte, v interface{}) error { +func (p *Parser) Unmarshal(data []byte, v any) error { if len(data) > 2 && data[0] == 0xef && data[1] == 0xbb && data[2] == 0xbf { data = data[3:] // Strip UTF-8 BOM, see https://www.rfc-editor.org/rfc/rfc8259#section-8.1 } diff --git a/parser/json/json_test.go b/parser/json/json_test.go index 81275218f..b27237e2d 100644 --- a/parser/json/json_test.go +++ b/parser/json/json_test.go @@ -26,7 +26,7 @@ func TestJSONParser(t *testing.T) { } }` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -35,7 +35,7 @@ func TestJSONParser(t *testing.T) { t.Fatalf("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) if len(inputMap) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } @@ -63,7 +63,7 @@ func TestJSONParserWithBOM(t *testing.T) { parser := &Parser{} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var got interface{} + var got any err := parser.Unmarshal(tt.input, &got) if (err != nil) != tt.wantErr { t.Errorf("Unmarshal() error = %v, wantErr %v", err, tt.wantErr) diff --git a/parser/jsonc/jsonc.go b/parser/jsonc/jsonc.go index e5f05b0ee..cac8f25d1 100644 --- a/parser/jsonc/jsonc.go +++ b/parser/jsonc/jsonc.go @@ -10,7 +10,7 @@ import ( type Parser struct{} // Unmarshal unmarshals JSON files. -func (p *Parser) Unmarshal(data []byte, v interface{}) error { +func (p *Parser) Unmarshal(data []byte, v any) error { if err := jsonc.Unmarshal(data, v); err != nil { return fmt.Errorf("unmarshal jsonc: %w", err) } diff --git a/parser/jsonc/jsonc_test.go b/parser/jsonc/jsonc_test.go index 88d089065..57132bc92 100644 --- a/parser/jsonc/jsonc_test.go +++ b/parser/jsonc/jsonc_test.go @@ -27,7 +27,7 @@ func TestJSONParser(t *testing.T) { } }` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -36,7 +36,7 @@ func TestJSONParser(t *testing.T) { t.Fatalf("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) if len(inputMap) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } diff --git a/parser/jsonnet/jsonnet.go b/parser/jsonnet/jsonnet.go index c6787cef1..1749d7538 100644 --- a/parser/jsonnet/jsonnet.go +++ b/parser/jsonnet/jsonnet.go @@ -19,7 +19,7 @@ func (p *Parser) SetPath(path string) { } // Unmarshal unmarshals Jsonnet files. -func (p *Parser) Unmarshal(data []byte, v interface{}) error { +func (p *Parser) Unmarshal(data []byte, v any) error { vm := jsonnet.MakeVM() vm.ErrorFormatter.SetMaxStackTraceSize(20) diff --git a/parser/jsonnet/jsonnet_test.go b/parser/jsonnet/jsonnet_test.go index a9153139b..11fdcd1c1 100644 --- a/parser/jsonnet/jsonnet_test.go +++ b/parser/jsonnet/jsonnet_test.go @@ -12,7 +12,7 @@ func TestJsonnetParser(t *testing.T) { tests := []struct { name string input string - want map[string]interface{} + want map[string]any wantErr bool errMsg string }{ @@ -25,12 +25,12 @@ func TestJsonnetParser(t *testing.T) { }, person2: self.person1 { name: "Bob" }, }`, - want: map[string]interface{}{ - "person1": map[string]interface{}{ + want: map[string]any{ + "person1": map[string]any{ "name": "Alice", "welcome": "Hello Alice!", }, - "person2": map[string]interface{}{ + "person2": map[string]any{ "name": "Bob", "welcome": "Hello Bob!", }, @@ -45,7 +45,7 @@ func TestJsonnetParser(t *testing.T) { c: 10 - 5, d: 15 / 3, }`, - want: map[string]interface{}{ + want: map[string]any{ "a": float64(3), "b": float64(18), "c": float64(5), @@ -68,11 +68,11 @@ func TestJsonnetParser(t *testing.T) { a: { b: { c: "deep" } }, }, }`, - want: map[string]interface{}{ - "numbers": []interface{}{float64(1), float64(2), float64(3)}, - "nested": map[string]interface{}{ - "a": map[string]interface{}{ - "b": map[string]interface{}{ + want: map[string]any{ + "numbers": []any{float64(1), float64(2), float64(3)}, + "nested": map[string]any{ + "a": map[string]any{ + "b": map[string]any{ "c": "deep", }, }, @@ -100,7 +100,7 @@ func TestJsonnetParser(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var got interface{} + var got any err := parser.Unmarshal([]byte(tt.input), &got) if (err != nil) != tt.wantErr { @@ -155,15 +155,15 @@ func TestJsonnetImports(t *testing.T) { path string content []byte wantErr bool - validate func(t *testing.T, result interface{}) + validate func(t *testing.T, result any) }{ { name: "successful import", path: mainPath, content: []byte(mainContent), - validate: func(t *testing.T, result interface{}) { + validate: func(t *testing.T, result any) { t.Helper() - m, ok := result.(map[string]interface{}) + m, ok := result.(map[string]any) if !ok { t.Fatal("result is not a map") } @@ -190,7 +190,7 @@ func TestJsonnetImports(t *testing.T) { parser.SetPath(tt.path) } - var result interface{} + var result any err := parser.Unmarshal(tt.content, &result) // Check error expectation diff --git a/parser/parser.go b/parser/parser.go index 0c46ca84b..50925f94c 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -63,7 +63,7 @@ const ( // Parser defines all of the methods that every parser // definition must implement. type Parser interface { - Unmarshal(p []byte, v interface{}) error + Unmarshal(p []byte, v any) error } // PathAwareParser is an optional interface that parsers may implement @@ -247,7 +247,7 @@ func FileSupported(path string) bool { // ParseConfigurations parses and returns the configurations from the given // list of files. The result will be a map where the key is the file name of // the configuration. -func ParseConfigurations(files []string) (map[string]interface{}, error) { +func ParseConfigurations(files []string) (map[string]any, error) { configurations, err := parseConfigurations(files, "") if err != nil { return nil, err @@ -259,7 +259,7 @@ func ParseConfigurations(files []string) (map[string]interface{}, error) { // ParseConfigurationsAs parses the files as the given file type and returns the // configurations given in the file list. The result will be a map where the key // is the file name of the configuration. -func ParseConfigurationsAs(files []string, parser string) (map[string]interface{}, error) { +func ParseConfigurationsAs(files []string, parser string) (map[string]any, error) { configurations, err := parseConfigurations(files, parser) if err != nil { return nil, err @@ -271,15 +271,15 @@ func ParseConfigurationsAs(files []string, parser string) (map[string]interface{ // CombineConfigurations takes the given configurations and combines them into a single // configuration. The result will be a map that contains a single key with a value of // Combined. -func CombineConfigurations(configs map[string]interface{}) map[string]interface{} { +func CombineConfigurations(configs map[string]any) map[string]any { type configuration struct { - Path string `json:"path"` - Contents interface{} `json:"contents"` + Path string `json:"path"` + Contents any `json:"contents"` } var allConfigurations []configuration for path, config := range configs { - if subconfigs, exist := config.([]interface{}); exist { + if subconfigs, exist := config.([]any); exist { for _, subconfig := range subconfigs { configuration := configuration{ Path: path, @@ -305,14 +305,14 @@ func CombineConfigurations(configs map[string]interface{}) map[string]interface{ return allConfigurations[i].Path < allConfigurations[j].Path }) - combinedConfigurations := make(map[string]interface{}) + combinedConfigurations := make(map[string]any) combinedConfigurations["Combined"] = allConfigurations return combinedConfigurations } -func parseConfigurations(paths []string, parser string) (map[string]interface{}, error) { - parsedConfigurations := make(map[string]interface{}) +func parseConfigurations(paths []string, parser string) (map[string]any, error) { + parsedConfigurations := make(map[string]any) errWithPathInfo := func(err error, msg, path string) error { return fmt.Errorf("%s: %w, path: %s", msg, err, path) } @@ -338,7 +338,7 @@ func parseConfigurations(paths []string, parser string) (map[string]interface{}, p.SetPath(path) } - var parsed interface{} + var parsed any if err := fileParser.Unmarshal(contents, &parsed); err != nil { return nil, errWithPathInfo(err, "parser unmarshal", path) } diff --git a/parser/properties/properties.go b/parser/properties/properties.go index 49f41eb9e..6841176b6 100644 --- a/parser/properties/properties.go +++ b/parser/properties/properties.go @@ -10,7 +10,7 @@ import ( // Parser is a properties parser. type Parser struct{} -func (pp *Parser) Unmarshal(p []byte, v interface{}) error { +func (pp *Parser) Unmarshal(p []byte, v any) error { rawProps, err := prop.LoadString(string(p)) if err != nil { return fmt.Errorf("Could not parse properties file: %w", err) diff --git a/parser/properties/properties_test.go b/parser/properties/properties_test.go index 664e95e3b..8fbbbb78e 100644 --- a/parser/properties/properties_test.go +++ b/parser/properties/properties_test.go @@ -11,7 +11,7 @@ func TestPropertiesParser(t *testing.T) { ! some comment=not-a-prop my-property=some-value` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Errorf("parser should not have thrown an error: %v", err) } @@ -20,7 +20,7 @@ my-property=some-value` t.Errorf("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) myProp := inputMap["my-property"].(string) if myProp != "some-value" { t.Errorf("Failed to parse property: %s", myProp) diff --git a/parser/spdx/spdx.go b/parser/spdx/spdx.go index 9b64da512..df0f5fa62 100644 --- a/parser/spdx/spdx.go +++ b/parser/spdx/spdx.go @@ -12,7 +12,7 @@ import ( type Parser struct{} // Unmarshal unmarshals SPDX files. -func (*Parser) Unmarshal(p []byte, v interface{}) error { +func (*Parser) Unmarshal(p []byte, v any) error { doc, err := tagvalue.Read(bytes.NewBuffer(p)) if err != nil { return fmt.Errorf("error while parsing %v: %v", p, err) diff --git a/parser/spdx/spdx_test.go b/parser/spdx/spdx_test.go index 21eeb85fd..2ac359dd6 100644 --- a/parser/spdx/spdx_test.go +++ b/parser/spdx/spdx_test.go @@ -16,7 +16,7 @@ Created: 2021-08-26T01:46:00Z parser := &Parser{} - var input interface{} + var input any if err := parser.Unmarshal([]byte(p), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -25,7 +25,7 @@ Created: 2021-08-26T01:46:00Z t.Error("There should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) currentDataLicense := inputMap["dataLicense"] expectedDataLicense := "conftest-demo" if currentDataLicense != expectedDataLicense { diff --git a/parser/toml/toml.go b/parser/toml/toml.go index 8cf09d9bc..a9a75faa3 100644 --- a/parser/toml/toml.go +++ b/parser/toml/toml.go @@ -10,7 +10,7 @@ import ( type Parser struct{} // Unmarshal unmarshals TOML files. -func (tp *Parser) Unmarshal(p []byte, v interface{}) error { +func (tp *Parser) Unmarshal(p []byte, v any) error { if err := toml.Unmarshal(p, v); err != nil { return fmt.Errorf("unmarshal toml: %w", err) } diff --git a/parser/toml/toml_test.go b/parser/toml/toml_test.go index b64a35828..29a2f252b 100644 --- a/parser/toml/toml_test.go +++ b/parser/toml/toml_test.go @@ -13,7 +13,7 @@ func TestTomlParser(t *testing.T) { address = ":80" compress = true` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -22,9 +22,9 @@ func TestTomlParser(t *testing.T) { t.Fatalf("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) item := inputMap["entryPoints"] - if len(item.(map[string]interface{})) == 0 { + if len(item.(map[string]any)) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } } diff --git a/parser/vcl/vcl.go b/parser/vcl/vcl.go index 30e1f09aa..83e895610 100644 --- a/parser/vcl/vcl.go +++ b/parser/vcl/vcl.go @@ -11,8 +11,8 @@ import ( type Parser struct{} // Unmarshal unmarshals VCL files. -func (p *Parser) Unmarshal(b []byte, v interface{}) error { - result := make(map[string]interface{}) +func (p *Parser) Unmarshal(b []byte, v any) error { + result := make(map[string]any) if errs := vcl.Decode(b, &result); len(errs) > 0 { return fmt.Errorf("decode vcl: %w", errs[0]) } diff --git a/parser/vcl/vcl_test.go b/parser/vcl/vcl_test.go index b106642ff..16e3a354f 100644 --- a/parser/vcl/vcl_test.go +++ b/parser/vcl/vcl_test.go @@ -9,7 +9,7 @@ func TestVCLParser(t *testing.T) { "localhost"; }` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -18,7 +18,7 @@ func TestVCLParser(t *testing.T) { t.Error("there should be information parsed but its nil") } - item := input.(map[string]interface{}) + item := input.(map[string]any) if len(item) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") diff --git a/parser/xml/xml.go b/parser/xml/xml.go index d0a961fa5..e0122377f 100644 --- a/parser/xml/xml.go +++ b/parser/xml/xml.go @@ -12,7 +12,7 @@ import ( type Parser struct{} // Unmarshal unmarshals XML files. -func (xml *Parser) Unmarshal(p []byte, v interface{}) error { +func (xml *Parser) Unmarshal(p []byte, v any) error { res, err := x.Convert(bytes.NewReader(p)) if err != nil { return fmt.Errorf("unmarshal xml: %w", err) diff --git a/parser/xml/xml_test.go b/parser/xml/xml_test.go index e22239def..0a4442a47 100644 --- a/parser/xml/xml_test.go +++ b/parser/xml/xml_test.go @@ -13,7 +13,7 @@ func TestXMLParser(t *testing.T) { baz ` - var input interface{} + var input any if err := parser.Unmarshal([]byte(sample), &input); err != nil { t.Fatalf("parser should not have thrown an error: %v", err) } @@ -22,9 +22,9 @@ func TestXMLParser(t *testing.T) { t.Fatalf("there should be information parsed but its nil") } - inputMap := input.(map[string]interface{}) + inputMap := input.(map[string]any) item := inputMap["note"] - if len(item.(map[string]interface{})) == 0 { + if len(item.(map[string]any)) == 0 { t.Error("there should be at least one item defined in the parsed file, but none found") } } diff --git a/parser/yaml/yaml.go b/parser/yaml/yaml.go index 31617a61a..726b35e72 100644 --- a/parser/yaml/yaml.go +++ b/parser/yaml/yaml.go @@ -18,7 +18,7 @@ var ( ) // Unmarshal unmarshals YAML files. -func (yp *Parser) Unmarshal(p []byte, v interface{}) error { +func (yp *Parser) Unmarshal(p []byte, v any) error { subDocuments := separateSubDocuments(p) if len(subDocuments) > 1 { if err := unmarshalMultipleDocuments(subDocuments, v); err != nil { @@ -68,10 +68,10 @@ func separateSubDocuments(data []byte) [][]byte { return parts } -func unmarshalMultipleDocuments(subDocuments [][]byte, v interface{}) error { - var documentStore []interface{} +func unmarshalMultipleDocuments(subDocuments [][]byte, v any) error { + var documentStore []any for _, subDocument := range subDocuments { - var documentObject interface{} + var documentObject any if err := yaml.Unmarshal(subDocument, &documentObject); err != nil { return fmt.Errorf("unmarshal subdocument yaml: %w", err) } diff --git a/parser/yaml/yaml_test.go b/parser/yaml/yaml_test.go index 775023dd6..e75ad37b8 100644 --- a/parser/yaml/yaml_test.go +++ b/parser/yaml/yaml_test.go @@ -13,7 +13,7 @@ func TestYAMLParser(t *testing.T) { testTable := []struct { name string controlConfigs []byte - expectedResult interface{} + expectedResult any shouldError bool }{ { @@ -25,7 +25,7 @@ func TestYAMLParser(t *testing.T) { { name: "a single config", controlConfigs: []byte(`sample: true`), - expectedResult: map[string]interface{}{ + expectedResult: map[string]any{ "sample": true, }, shouldError: false, @@ -38,14 +38,14 @@ sample: true hello: true --- nice: true`), - expectedResult: []interface{}{ - map[string]interface{}{ + expectedResult: []any{ + map[string]any{ "sample": true, }, - map[string]interface{}{ + map[string]any{ "hello": true, }, - map[string]interface{}{ + map[string]any{ "nice": true, }, }, @@ -59,14 +59,14 @@ sample: true hello: true --- nice: true`, "\n", "\r\n")), - expectedResult: []interface{}{ - map[string]interface{}{ + expectedResult: []any{ + map[string]any{ "sample": true, }, - map[string]interface{}{ + map[string]any{ "hello": true, }, - map[string]interface{}{ + map[string]any{ "nice": true, }, }, @@ -90,7 +90,7 @@ also_valid: true`), controlConfigs: []byte(`%YAML 1.1 --- group_id: 1234`), - expectedResult: map[string]interface{}{ + expectedResult: map[string]any{ "group_id": float64(1234), }, shouldError: false, @@ -104,14 +104,14 @@ group_id: 1234 other_id: 5678 --- third_id: 9012`), - expectedResult: []interface{}{ - map[string]interface{}{ + expectedResult: []any{ + map[string]any{ "group_id": float64(1234), }, - map[string]interface{}{ + map[string]any{ "other_id": float64(5678), }, - map[string]interface{}{ + map[string]any{ "third_id": float64(9012), }, }, @@ -121,7 +121,7 @@ third_id: 9012`), for _, test := range testTable { t.Run(test.name, func(t *testing.T) { - var unmarshalledConfigs interface{} + var unmarshalledConfigs any yamlParser := new(yaml.Parser) err := yamlParser.Unmarshal(test.controlConfigs, &unmarshalledConfigs) diff --git a/policy/engine.go b/policy/engine.go index 93e58a31d..736e64fd9 100644 --- a/policy/engine.go +++ b/policy/engine.go @@ -172,7 +172,7 @@ func (e *Engine) ShowBuiltinErrors() { } // Check executes all of the loaded policies against the input and returns the results. -func (e *Engine) Check(ctx context.Context, configs map[string]interface{}, namespace string) ([]output.CheckResult, error) { +func (e *Engine) Check(ctx context.Context, configs map[string]any, namespace string) ([]output.CheckResult, error) { var checkResults []output.CheckResult for path, config := range configs { @@ -181,7 +181,7 @@ func (e *Engine) Check(ctx context.Context, configs map[string]interface{}, name // // If the current configuration contains multiple configurations, evaluate each policy // independent from one another and aggregate the results under the same file name. - if subconfigs, exist := config.([]interface{}); exist { + if subconfigs, exist := config.([]any); exist { checkResult := output.CheckResult{ FileName: path, @@ -215,7 +215,7 @@ func (e *Engine) Check(ctx context.Context, configs map[string]interface{}, name } // CheckCombined combines the input and evaluates the policies against the combined result. -func (e *Engine) CheckCombined(ctx context.Context, configs map[string]interface{}, namespace string) (output.CheckResult, error) { +func (e *Engine) CheckCombined(ctx context.Context, configs map[string]any, namespace string) (output.CheckResult, error) { combinedConfigs := parser.CombineConfigurations(configs) result, err := e.check(ctx, "Combined", combinedConfigs["Combined"], namespace) @@ -290,7 +290,7 @@ func (e *Engine) Runtime() *ast.Term { return ast.NewTerm(obj) } -func (e *Engine) check(ctx context.Context, path string, config interface{}, namespace string) (output.CheckResult, error) { +func (e *Engine) check(ctx context.Context, path string, config any, namespace string) (output.CheckResult, error) { if err := e.addFileInfo(ctx, path); err != nil { return output.CheckResult{}, fmt.Errorf("add file info: %w", err) } @@ -441,7 +441,7 @@ func (e *Engine) addFileInfo(ctx context.Context, path string) error { // Example queries could include: // data.main.deny to query the deny rule in the main namespace // data.main.warn to query the warn rule in the main namespace -func (e *Engine) query(ctx context.Context, input interface{}, query string) (output.QueryResult, error) { +func (e *Engine) query(ctx context.Context, input any, query string) (output.QueryResult, error) { ph := printHook{s: &[]string{}} builtInErrors := &[]topdown.Error{} options := []func(r *rego.Rego){ @@ -486,9 +486,9 @@ func (e *Engine) query(ctx context.Context, input interface{}, query string) (ou // // When an expression does not have a slice of values, the expression did not // evaluate to true, and no message was returned. - var expressionValues []interface{} - if _, ok := expression.Value.([]interface{}); ok { - expressionValues = expression.Value.([]interface{}) + var expressionValues []any + if _, ok := expression.Value.([]any); ok { + expressionValues = expression.Value.([]any) } if len(expressionValues) == 0 { results = append(results, output.Result{}) @@ -509,7 +509,7 @@ func (e *Engine) query(ctx context.Context, input interface{}, query string) (ou results = append(results, result) // Policies that return metadata (e.g. deny[{"msg": msg}]) - case map[string]interface{}: + case map[string]any: result, err := output.NewResult(val) if err != nil { return output.QueryResult{}, fmt.Errorf("new result: %w", err) diff --git a/runner/test.go b/runner/test.go index 78487db30..77ff8bfe5 100644 --- a/runner/test.go +++ b/runner/test.go @@ -45,7 +45,7 @@ func (t *TestRunner) Run(ctx context.Context, fileList []string) ([]output.Check return nil, fmt.Errorf("parse files: %w", err) } - var configurations map[string]interface{} + var configurations map[string]any if t.Parser != "" { configurations, err = parser.ParseConfigurationsAs(files, t.Parser) } else {