Skip to content

Commit 77f18ac

Browse files
committed
SQUASHME
1 parent 84b653a commit 77f18ac

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

obj/atlas/atlas.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Atlas struct {
2222
// unmarshaller hits a tag. Values are a subset of `mappings`.
2323
tagMappings map[int]*AtlasEntry
2424

25+
// MapMorphism specifies the default map sorting scheme
2526
MapMorphism *MapMorphism
2627
}
2728

obj/atlas/mapMorphism.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ package atlas
44
type KeySortMode string
55

66
const (
7-
KeySortMode_Default = "default" // e.g. lexical string sort for strings, etc
8-
KeySortMode_RFC7049 = "rfc7049" // "Canonical" as proposed by rfc7049 § 3.9 (shorter byte sequences sort to top)
7+
KeySortMode_Default = KeySortMode("default") // e.g. lexical string sort for strings, etc
8+
KeySortMode_RFC7049 = KeySortMode("rfc7049") // "Canonical" as proposed by rfc7049 § 3.9 (shorter byte sequences sort to top)
99
)
1010

1111
type MapMorphism struct {

obj/marshalMapWildcard.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ func (mach *marshalMachineMapWildcard) Reset(slab *marshalSlab, rv reflect.Value
4747
mach.keys[i].rv = v
4848
mach.keys[i].s = v.String()
4949
}
50-
switch mach.morphism.KeySortMode {
50+
51+
ksm := atlas.KeySortMode_Default
52+
if mach.morphism != nil {
53+
ksm = mach.morphism.KeySortMode
54+
}
55+
56+
switch ksm {
5157
case atlas.KeySortMode_Default:
5258
sort.Sort(wildcardMapStringyKey_byString(mach.keys))
5359
case atlas.KeySortMode_RFC7049:

0 commit comments

Comments
 (0)