chore(internal): fix modernize linter

#### Description

fix modernize linter in internal/chart/v3

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/31799/head
Matthieu MOREL 7 months ago
parent fbb8de54be
commit 859292e31b

@ -45,7 +45,7 @@ type Chart struct {
// Templates for this chart. // Templates for this chart.
Templates []*common.File `json:"templates"` Templates []*common.File `json:"templates"`
// Values are default config for this chart. // Values are default config for this chart.
Values map[string]interface{} `json:"values"` Values map[string]any `json:"values"`
// Schema is an optional JSON schema for imposing structure on Values // Schema is an optional JSON schema for imposing structure on Values
Schema []byte `json:"schema"` Schema []byte `json:"schema"`
// SchemaModTime the schema was last modified // SchemaModTime the schema was last modified

@ -44,7 +44,7 @@ type Dependency struct {
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
// ImportValues holds the mapping of source values to parent key to be imported. Each item can be a // ImportValues holds the mapping of source values to parent key to be imported. Each item can be a
// string or pair of child/parent sublist items. // string or pair of child/parent sublist items.
ImportValues []interface{} `json:"import-values,omitempty" yaml:"import-values,omitempty"` ImportValues []any `json:"import-values,omitempty" yaml:"import-values,omitempty"`
// Alias usable alias to be used for the chart // Alias usable alias to be used for the chart
Alias string `json:"alias,omitempty" yaml:"alias,omitempty"` Alias string `json:"alias,omitempty" yaml:"alias,omitempty"`
} }

@ -25,6 +25,6 @@ func (v ValidationError) Error() string {
} }
// ValidationErrorf takes a message and formatting options and creates a ValidationError // ValidationErrorf takes a message and formatting options and creates a ValidationError
func ValidationErrorf(msg string, args ...interface{}) ValidationError { func ValidationErrorf(msg string, args ...any) ValidationError {
return ValidationError(fmt.Sprintf(msg, args...)) return ValidationError(fmt.Sprintf(msg, args...))
} }

@ -43,7 +43,7 @@ func WithSkipSchemaValidation(skipSchemaValidation bool) LinterOption {
} }
} }
func RunAll(baseDir string, values map[string]interface{}, namespace string, options ...LinterOption) support.Linter { func RunAll(baseDir string, values map[string]any, namespace string, options ...LinterOption) support.Linter {
chartDir, _ := filepath.Abs(baseDir) chartDir, _ := filepath.Abs(baseDir)

@ -49,7 +49,7 @@ func TestValidateAllowedExtension(t *testing.T) {
} }
} }
var values = map[string]interface{}{"nameOverride": "", "httpPort": 80} var values = map[string]any{"nameOverride": "", "httpPort": 80}
const namespace = "testNamespace" const namespace = "testNamespace"
const strict = false const strict = false
@ -249,7 +249,7 @@ func TestStrictTemplateParsingMapError(t *testing.T) {
APIVersion: "v2", APIVersion: "v2",
Version: "0.1.0", Version: "0.1.0",
}, },
Values: map[string]interface{}{ Values: map[string]any{
"mymap": map[string]string{ "mymap": map[string]string{
"key1": "val1", "key1": "val1",
}, },

@ -670,7 +670,7 @@ func CreateFrom(chartfile *chart.Metadata, dest, src string) error {
return fmt.Errorf("reading values file: %w", err) return fmt.Errorf("reading values file: %w", err)
} }
var m map[string]interface{} var m map[string]any
if err := yaml.Unmarshal(transform(string(b), schart.Name()), &m); err != nil { if err := yaml.Unmarshal(transform(string(b), schart.Name()), &m); err != nil {
return fmt.Errorf("transforming values file: %w", err) return fmt.Errorf("transforming values file: %w", err)
} }

@ -29,8 +29,8 @@ var updateGolden = flag.Bool("update", false, "update golden files")
// TestingT describes a testing object compatible with the critical functions from the testing.T type // TestingT describes a testing object compatible with the critical functions from the testing.T type
type TestingT interface { type TestingT interface {
Fatal(...interface{}) Fatal(...any)
Fatalf(string, ...interface{}) Fatalf(string, ...any)
HelperT HelperT
} }

Loading…
Cancel
Save