Skip to content

Commit

Permalink
Improve yaml doc seperator match (#329)
Browse files Browse the repository at this point in the history
According to the yaml spec, the seperator can have
"a line break or a sequence of space characters"

Fixes #327
  • Loading branch information
mpfz0r authored and bernd committed Jan 10, 2019
1 parent ce69678 commit f5388d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cfgfile/cfgfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"flag"
"fmt"
"os"
"regexp"
"runtime"
"strings"

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

0 comments on commit f5388d8

Please sign in to comment.