lib/config: Sort versioning options on marshal (fixes #6576) (#6577)

This commit is contained in:
Jakob Borg 2020-04-27 00:13:35 +02:00 committed by GitHub
parent 6c73617974
commit 8c61e0d6ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,10 @@
package config
import "encoding/xml"
import (
"encoding/xml"
"sort"
)
type VersioningConfiguration struct {
Type string `xml:"type,attr" json:"type"`
@ -38,6 +41,9 @@ func (c *VersioningConfiguration) MarshalXML(e *xml.Encoder, start xml.StartElem
for k, v := range c.Params {
tmp.Params = append(tmp.Params, InternalParam{k, v})
}
sort.Slice(tmp.Params, func(a, b int) bool {
return tmp.Params[a].Key < tmp.Params[b].Key
})
return e.EncodeElement(tmp, start)