summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-ini/ini/file.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-ini/ini/file.go')
-rw-r--r--vendor/github.com/go-ini/ini/file.go15
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
}