diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-04-16 05:37:14 -0700 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-04-16 08:37:14 -0400 |
commit | 6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch) | |
tree | 3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/github.com/go-ini/ini/file.go | |
parent | bf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff) | |
download | chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2 chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip |
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/github.com/go-ini/ini/file.go')
-rw-r--r-- | vendor/github.com/go-ini/ini/file.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/vendor/github.com/go-ini/ini/file.go b/vendor/github.com/go-ini/ini/file.go index ce26c3b31..d7982c323 100644 --- a/vendor/github.com/go-ini/ini/file.go +++ b/vendor/github.com/go-ini/ini/file.go @@ -140,9 +140,14 @@ func (f *File) Section(name string) *Section { // Section returns list of Section. func (f *File) Sections() []*Section { + if f.BlockMode { + f.lock.RLock() + defer f.lock.RUnlock() + } + sections := make([]*Section, len(f.sectionList)) - for i := range f.sectionList { - sections[i] = f.Section(f.sectionList[i]) + for i, name := range f.sectionList { + sections[i] = f.sections[name] } return sections } @@ -223,7 +228,7 @@ func (f *File) Append(source interface{}, others ...interface{}) error { func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { equalSign := "=" - if PrettyFormat { + if PrettyFormat || PrettyEqual { equalSign = " = " } @@ -300,6 +305,10 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { } else { key.Comment = key.Comment[:1] + " " + strings.TrimSpace(key.Comment[1:]) } + + // Support multiline comments + key.Comment = strings.Replace(key.Comment, "\n", "\n; ", -1) + if _, err := buf.WriteString(key.Comment + LineBreak); err != nil { return nil, err } |