Skip to content

Commit b927c6a

Browse files
authored
Merge pull request #1415 from urfave/upgrade-go-yaml
Upgrade gopkg.in/yaml to v3
2 parents e576ba4 + 72dc91d commit b927c6a

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

altsrc/map_input_source.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ func nestedVal(name string, tree map[interface{}]interface{}) (interface{}, bool
3232
if !ok {
3333
return nil, false
3434
}
35-
ctype, ok := child.(map[interface{}]interface{})
36-
if !ok {
35+
36+
switch child := child.(type) {
37+
case map[string]interface{}:
38+
node = make(map[interface{}]interface{}, len(child))
39+
for k, v := range child {
40+
node[k] = v
41+
}
42+
case map[interface{}]interface{}:
43+
node = child
44+
default:
3745
return nil, false
3846
}
39-
node = ctype
4047
}
4148
if val, ok := node[sections[len(sections)-1]]; ok {
4249
return val, true

altsrc/yaml_file_loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/urfave/cli/v2"
1313

14-
"gopkg.in/yaml.v2"
14+
"gopkg.in/yaml.v3"
1515
)
1616

1717
type yamlSourceContext struct {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/cpuguy83/go-md2man/v2 v2.0.1
88
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
99
golang.org/x/text v0.3.7
10-
gopkg.in/yaml.v2 v2.4.0
10+
gopkg.in/yaml.v3 v3.0.1
1111
)
1212

1313
require github.com/russross/blackfriday/v2 v2.1.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IK
1212
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
1313
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1414
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
15-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
16-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
15+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
16+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/genflags/cmd/genflags/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
"github.com/urfave/cli/v2"
1717
"github.com/urfave/cli/v2/internal/genflags"
18-
"gopkg.in/yaml.v2"
18+
"gopkg.in/yaml.v3"
1919
)
2020

2121
const (

0 commit comments

Comments
 (0)