Trim whitespaces before checking if line is empty or comment

pull/229/head
Vladimir Zorin 2019-03-14 14:12:02 +02:00
parent 567532d74d
commit d1348b9898
1 changed files with 3 additions and 2 deletions

View File

@ -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
} }
} }