From 8a897dbd24aaaa87cd59c84fa1ad90e37a3f93b2 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 20 Dec 2022 23:26:38 +0000 Subject: [PATCH] Fix writespacing in writing function --- ini.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ini.go b/ini.go index 29f8d63..a94cd89 100644 --- a/ini.go +++ b/ini.go @@ -102,9 +102,7 @@ func Write(writer io.StringWriter, entries []Entry) error { for _, entry := range entries { if entry.Section != section { - section = entry.Section - - if _, writeError := writer.WriteString("["); writeError != nil { + if _, writeError := writer.WriteString("\n["); writeError != nil { return writeError } @@ -112,9 +110,11 @@ func Write(writer io.StringWriter, entries []Entry) error { return writeError } - if _, writeError := writer.WriteString("]"); writeError != nil { + if _, writeError := writer.WriteString("]\n"); writeError != nil { return writeError } + + section = entry.Section } if _, writeError := writer.WriteString(entry.Key); writeError != nil {