Skip to content

Commit f86e6f6

Browse files
committed
Upgrade yaml to v3
As requested in "Update the yaml dependency to v3? #206".
1 parent 39ebbbb commit f86e6f6

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func main() {
170170

171171
Note: if test are failing due missing package, please execute:
172172

173-
go get gopkg.in/yaml.v2
173+
go get gopkg.in/yaml.v3
174174

175175
### Transformers
176176

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/imdario/mergo
22

33
go 1.13
44

5-
require gopkg.in/yaml.v2 v2.3.0
5+
require gopkg.in/yaml.v3 v3.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
22
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3-
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
4-
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3+
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
4+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

mergo_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/imdario/mergo"
16-
"gopkg.in/yaml.v2"
16+
"gopkg.in/yaml.v3"
1717
)
1818

1919
type simpleTest struct {
@@ -603,18 +603,18 @@ func TestMapsWithNilPointer(t *testing.T) {
603603
func TestYAMLMaps(t *testing.T) {
604604
thing := loadYAML("testdata/thing.yml")
605605
license := loadYAML("testdata/license.yml")
606-
ft := thing["fields"].(map[interface{}]interface{})
607-
fl := license["fields"].(map[interface{}]interface{})
606+
ft := thing["fields"].(map[string]interface{})
607+
fl := license["fields"].(map[string]interface{})
608608
// license has one extra field (site) and another already existing in thing (author) that Mergo won't override.
609609
expectedLength := len(ft) + len(fl) - 1
610610
if err := mergo.Merge(&license, thing); err != nil {
611611
t.Error(err.Error())
612612
}
613-
currentLength := len(license["fields"].(map[interface{}]interface{}))
613+
currentLength := len(license["fields"].(map[string]interface{}))
614614
if currentLength != expectedLength {
615615
t.Errorf(`thing not merged in license properly, license must have %d elements instead of %d`, expectedLength, currentLength)
616616
}
617-
fields := license["fields"].(map[interface{}]interface{})
617+
fields := license["fields"].(map[string]interface{})
618618
if _, ok := fields["id"]; !ok {
619619
t.Errorf(`thing not merged in license properly, license must have a new id field from thing`)
620620
}

0 commit comments

Comments
 (0)