From fa65ea73d7d079f39463135bced5ec29374419c8 Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Thu, 6 May 2021 01:02:07 +0200 Subject: [PATCH] Apply sort order fix Pending cherry-pick PR (from v3 to v2) in https://github.com/go-yaml/yaml/pull/736 Closes #301 --- go.mod | 2 ++ go.sum | 2 ++ vendor/gopkg.in/yaml.v2/sorter.go | 8 +++++++- vendor/modules.txt | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 8d470159..9c003867 100644 --- a/go.mod +++ b/go.mod @@ -35,3 +35,5 @@ require ( ) go 1.13 + +replace gopkg.in/yaml.v2 => github.com/mkmik/yaml v0.0.0-20210505221935-5a0cbc1c4094 diff --git a/go.sum b/go.sum index 3584e80b..bd7f7193 100644 --- a/go.sum +++ b/go.sum @@ -366,6 +366,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mkmik/yaml v0.0.0-20210505221935-5a0cbc1c4094 h1:O6LklvAVDH55mVVD6CGnT/fmOSBDxVnvbFPSNbssreY= +github.com/mkmik/yaml v0.0.0-20210505221935-5a0cbc1c4094/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= diff --git a/vendor/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v2/sorter.go index 4c45e660..98e40b5a 100644 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ b/vendor/gopkg.in/yaml.v2/sorter.go @@ -37,8 +37,10 @@ func (l keyList) Less(i, j int) bool { return ak < bk } ar, br := []rune(a.String()), []rune(b.String()) + digits := false for i := 0; i < len(ar) && i < len(br); i++ { if ar[i] == br[i] { + digits = unicode.IsDigit(ar[i]) continue } al := unicode.IsLetter(ar[i]) @@ -47,7 +49,11 @@ func (l keyList) Less(i, j int) bool { return ar[i] < br[i] } if al || bl { - return bl + if digits { + return al + } else { + return bl + } } var ai, bi int var an, bn int64 diff --git a/vendor/modules.txt b/vendor/modules.txt index edebada7..a3106182 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -297,7 +297,7 @@ gopkg.in/fsnotify.v1 gopkg.in/inf.v0 # gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 gopkg.in/tomb.v1 -# gopkg.in/yaml.v2 v2.4.0 +# gopkg.in/yaml.v2 v2.4.0 => github.com/mkmik/yaml v0.0.0-20210505221935-5a0cbc1c4094 gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 gopkg.in/yaml.v3