Switch to using builtin functionality for file extensions

Signed-off-by: Ian Howell <ian.howell0@gmail.com>
pull/5350/head
Ian Howell 7 years ago
parent 304f1c4684
commit 8e050bb4b0

@ -19,7 +19,6 @@ package rules
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"strings"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -54,7 +53,8 @@ func validateValuesFile(valuesPath string) error {
return errors.Wrap(err, "unable to parse YAML") return errors.Wrap(err, "unable to parse YAML")
} }
schemaPath := strings.Replace(valuesPath, ".yaml", ".schema.yaml", 1) ext := filepath.Ext(valuesPath)
schemaPath := valuesPath[:len(valuesPath)-len(ext)] + ".schema.yaml"
schema, err := chartutil.ReadSchemaFile(schemaPath) schema, err := chartutil.ReadSchemaFile(schemaPath)
if len(schema) == 0 { if len(schema) == 0 {
return nil return nil

Loading…
Cancel
Save