mirror of https://github.com/k3s-io/k3s
Trim whitespaces before checking if line is empty or comment
parent
567532d74d
commit
d1348b9898
|
@ -254,8 +254,9 @@ func checksum(bytes []byte) string {
|
||||||
func isEmptyYaml(yaml []byte) bool {
|
func isEmptyYaml(yaml []byte) bool {
|
||||||
isEmpty := true
|
isEmpty := true
|
||||||
lines := bytes.Split(yaml, []byte("\n"))
|
lines := bytes.Split(yaml, []byte("\n"))
|
||||||
for _, k := range lines {
|
for _, l := range lines {
|
||||||
if string(k) != "---" && !bytes.HasPrefix(k, []byte("#")) && string(k) != "" {
|
s := bytes.TrimSpace(l)
|
||||||
|
if string(s) != "---" && !bytes.HasPrefix(s, []byte("#")) && string(s) != "" {
|
||||||
isEmpty = false
|
isEmpty = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue