Skip to content

Commit f5388d8

Browse files
mpfz0rbernd
authored andcommitted
Improve yaml doc seperator match (#329)
According to the yaml spec, the seperator can have "a line break or a sequence of space characters" Fixes #327
1 parent ce69678 commit f5388d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cfgfile/cfgfile.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"flag"
2121
"fmt"
2222
"os"
23+
"regexp"
2324
"runtime"
2425
"strings"
2526

@@ -65,7 +66,8 @@ func Read(out interface{}, path string) error {
6566
// append configuration, but strip away possible yaml doc separators
6667
scanner := bufio.NewScanner(configfile)
6768
for scanner.Scan() {
68-
if line := scanner.Text(); line != "---" {
69+
line := scanner.Text()
70+
if match, _ := regexp.Match("^---[ \t]*$", []byte(line)); !match {
6971
filecontent = append(filecontent, []byte(line+"\n")...)
7072
}
7173
}

0 commit comments

Comments
 (0)