We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e3e4f60 + 6654289 commit 415a79cCopy full SHA for 415a79c
unit/serialize.go
@@ -13,21 +13,19 @@ func Serialize(opts []*UnitOption) io.Reader {
13
return &buf
14
}
15
16
- curSection := opts[0].Section
17
-
18
- writeSectionHeader(&buf, curSection)
19
- writeNewline(&buf)
20
+ idx := map[string][]*UnitOption{}
21
for _, opt := range opts {
22
- if opt.Section != curSection {
23
- curSection = opt.Section
+ idx[opt.Section] = append(idx[opt.Section], opt)
+ }
24
25
26
+ for curSection, curOpts := range idx {
+ writeSectionHeader(&buf, curSection)
+ writeNewline(&buf)
+
+ for _, opt := range curOpts {
+ writeOption(&buf, opt)
27
writeNewline(&buf)
28
29
30
- writeOption(&buf, opt)
31
32
33
0 commit comments