File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 88 _ "embed"
99 "fmt"
1010 "regexp"
11+ "sort"
1112 "strconv"
1213 "strings"
1314
@@ -1452,7 +1453,29 @@ func LoadConfigINI(zuulConf string) *ini.File {
14521453}
14531454
14541455func DumpConfigINI (cfg * ini.File ) string {
1456+
14551457 writer := bytes .NewBufferString ("" )
1458+ sections := cfg .Sections ()
1459+
1460+ for _ , section := range sections {
1461+
1462+ keys := section .Keys ()
1463+ sortedKeys := []* ini.Key {}
1464+
1465+ sort .Slice (keys , func (i , j int ) bool {
1466+ return keys [i ].Name () < keys [j ].Name ()
1467+ })
1468+
1469+ for _ , key := range keys {
1470+ sortedKeys = append (sortedKeys , key )
1471+ section .DeleteKey (key .Name ())
1472+ }
1473+
1474+ for _ , key := range sortedKeys {
1475+ section .NewKey (key .Name (), key .Value ())
1476+ }
1477+
1478+ }
14561479 cfg .WriteTo (writer )
14571480 return writer .String ()
14581481}
You can’t perform that action at this time.
0 commit comments