fix(state): enhance error message for missing .gotmpl extension in helmfile v1 (#1989)

* fix(state): enhance error message for missing .gotmpl extension in helmfile

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2025-04-08 21:28:54 +08:00
committed by GitHub
parent dfe63135d6
commit eb32b6166e
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"io"
"path/filepath"
"slices"
"strings"
@@ -109,6 +110,9 @@ func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState,
if err == io.EOF {
break
} else if err != nil {
if filepath.Ext(file) != ".gotmpl" {
return nil, &StateLoadError{fmt.Sprintf("failed to read %s: reading document at index %d. Started seeing this since Helmfile v1? Add the .gotmpl file extension", file, i), err}
}
return nil, &StateLoadError{fmt.Sprintf("failed to read %s: reading document at index %d", file, i), err}
}