diff options
Diffstat (limited to 'vendor/gopkg.in/ini.v1')
-rw-r--r-- | vendor/gopkg.in/ini.v1/.editorconfig | 12 | ||||
-rw-r--r-- | vendor/gopkg.in/ini.v1/.gitignore | 1 | ||||
-rw-r--r-- | vendor/gopkg.in/ini.v1/file.go | 23 | ||||
-rw-r--r-- | vendor/gopkg.in/ini.v1/key.go | 3 |
4 files changed, 36 insertions, 3 deletions
diff --git a/vendor/gopkg.in/ini.v1/.editorconfig b/vendor/gopkg.in/ini.v1/.editorconfig new file mode 100644 index 00000000..4a2d9180 --- /dev/null +++ b/vendor/gopkg.in/ini.v1/.editorconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*_test.go] +trim_trailing_whitespace = false diff --git a/vendor/gopkg.in/ini.v1/.gitignore b/vendor/gopkg.in/ini.v1/.gitignore index 12411127..588388bd 100644 --- a/vendor/gopkg.in/ini.v1/.gitignore +++ b/vendor/gopkg.in/ini.v1/.gitignore @@ -4,3 +4,4 @@ ini.sublime-workspace testdata/conf_reflect.ini .idea /.vscode +.DS_Store diff --git a/vendor/gopkg.in/ini.v1/file.go b/vendor/gopkg.in/ini.v1/file.go index 7b4e560d..9d91c31a 100644 --- a/vendor/gopkg.in/ini.v1/file.go +++ b/vendor/gopkg.in/ini.v1/file.go @@ -442,16 +442,16 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { kname = `"""` + kname + `"""` } - for _, val := range key.ValueWithShadows() { + writeKeyValue := func(val string) (bool, error) { if _, err := buf.WriteString(kname); err != nil { - return nil, err + return false, err } if key.isBooleanType { if kname != sec.keyList[len(sec.keyList)-1] { buf.WriteString(LineBreak) } - continue KeyList + return true, nil } // Write out alignment spaces before "=" sign @@ -468,10 +468,27 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { val = `"` + val + `"` } if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil { + return false, err + } + return false, nil + } + + shadows := key.ValueWithShadows() + if len(shadows) == 0 { + if _, err := writeKeyValue(""); err != nil { return nil, err } } + for _, val := range shadows { + exitLoop, err := writeKeyValue(val) + if err != nil { + return nil, err + } else if exitLoop { + continue KeyList + } + } + for _, val := range key.nestedValues { if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil { return nil, err diff --git a/vendor/gopkg.in/ini.v1/key.go b/vendor/gopkg.in/ini.v1/key.go index 0302c291..21479742 100644 --- a/vendor/gopkg.in/ini.v1/key.go +++ b/vendor/gopkg.in/ini.v1/key.go @@ -113,6 +113,9 @@ func (k *Key) Value() string { // ValueWithShadows returns raw values of key and its shadows if any. func (k *Key) ValueWithShadows() []string { if len(k.shadows) == 0 { + if k.value == "" { + return []string{} + } return []string{k.value} } vals := make([]string, len(k.shadows)+1) |