Trim whitespaces before checking if line is empty or comment

This commit is contained in:
Vladimir Zorin 2019-03-14 14:12:02 +02:00
parent 567532d74d
commit d1348b9898

View File

@ -254,8 +254,9 @@ func checksum(bytes []byte) string {
func isEmptyYaml(yaml []byte) bool {
isEmpty := true
lines := bytes.Split(yaml, []byte("\n"))
for _, k := range lines {
if string(k) != "---" && !bytes.HasPrefix(k, []byte("#")) && string(k) != "" {
for _, l := range lines {
s := bytes.TrimSpace(l)
if string(s) != "---" && !bytes.HasPrefix(s, []byte("#")) && string(s) != "" {
isEmpty = false
}
}