diff options
author | 2018-06-30 17:07:33 +0100 | |
---|---|---|
committer | 2018-06-30 09:07:33 -0700 | |
commit | 9d555ab8d2f712a50ec1b7f46de0a7405a28eb9a (patch) | |
tree | cd63fcaa57bcd2ca5376dc40c3cd7a04b3909dc0 /vendor/github.com/go-ini/ini/parser.go | |
parent | 6fe27d99be622f69ac0b1d402a67a571c6f6166e (diff) | |
download | coredns-9d555ab8d2f712a50ec1b7f46de0a7405a28eb9a.tar.gz coredns-9d555ab8d2f712a50ec1b7f46de0a7405a28eb9a.tar.zst coredns-9d555ab8d2f712a50ec1b7f46de0a7405a28eb9a.zip |
Dep ensure -update (#1912)
* dep ensure -update
Signed-off-by: Miek Gieben <miek@miek.nl>
* Add new files
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'vendor/github.com/go-ini/ini/parser.go')
-rw-r--r-- | vendor/github.com/go-ini/ini/parser.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/vendor/github.com/go-ini/ini/parser.go b/vendor/github.com/go-ini/ini/parser.go index 826e893c0..d5aa2db60 100644 --- a/vendor/github.com/go-ini/ini/parser.go +++ b/vendor/github.com/go-ini/ini/parser.go @@ -198,7 +198,7 @@ func hasSurroundedQuote(in string, quote byte) bool { func (p *parser) readValue(in []byte, parserBufferSize int, - ignoreContinuation, ignoreInlineComment, unescapeValueDoubleQuotes, unescapeValueCommentSymbols, allowPythonMultilines bool) (string, error) { + ignoreContinuation, ignoreInlineComment, unescapeValueDoubleQuotes, unescapeValueCommentSymbols, allowPythonMultilines, spaceBeforeInlineComment bool) (string, error) { line := strings.TrimLeftFunc(string(in), unicode.IsSpace) if len(line) == 0 { @@ -240,11 +240,22 @@ func (p *parser) readValue(in []byte, // Check if ignore inline comment if !ignoreInlineComment { - i := strings.IndexAny(line, "#;") + var i int + if spaceBeforeInlineComment { + i = strings.Index(line, " #") + if i == -1 { + i = strings.Index(line, " ;") + } + + } else { + i = strings.IndexAny(line, "#;") + } + if i > -1 { p.comment.WriteString(line[i:]) line = strings.TrimSpace(line[:i]) } + } // Trim single and double quotes @@ -429,7 +440,8 @@ func (f *File) parse(reader io.Reader) (err error) { f.options.IgnoreInlineComment, f.options.UnescapeValueDoubleQuotes, f.options.UnescapeValueCommentSymbols, - f.options.AllowPythonMultilineValues) + f.options.AllowPythonMultilineValues, + f.options.SpaceBeforeInlineComment) if err != nil { return err } @@ -458,7 +470,8 @@ func (f *File) parse(reader io.Reader) (err error) { f.options.IgnoreInlineComment, f.options.UnescapeValueDoubleQuotes, f.options.UnescapeValueCommentSymbols, - f.options.AllowPythonMultilineValues) + f.options.AllowPythonMultilineValues, + f.options.SpaceBeforeInlineComment) if err != nil { return err } |