Skip to content

Commit 1c0126c

Browse files
go.mod,doc: replace YAML serializer
Fixes #2277.
1 parent db3ddb5 commit 1c0126c

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

doc/cmd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var dummyCmd = &cobra.Command{
9494

9595
func checkStringContains(t *testing.T, got, expected string) {
9696
if !strings.Contains(got, expected) {
97-
t.Errorf("Expected to contain: \n %v\nGot:\n %v\n", expected, got)
97+
t.Errorf("Expected string to contain: \n %v\nGot:\n %v\n", expected, got)
9898
}
9999
}
100100

doc/yaml_docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"sort"
2323
"strings"
2424

25+
yaml "github.com/goccy/go-yaml"
2526
"github.com/spf13/cobra"
2627
"github.com/spf13/pflag"
27-
"gopkg.in/yaml.v3"
2828
)
2929

3030
type cmdOption struct {

doc/yaml_docs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestGenYamlDoc(t *testing.T) {
3838
checkStringContains(t, output, "rootflag")
3939
checkStringContains(t, output, rootCmd.Short)
4040
checkStringContains(t, output, echoSubCmd.Short)
41-
checkStringContains(t, output, fmt.Sprintf("- %s - %s", echoSubCmd.CommandPath(), echoSubCmd.Short))
41+
checkStringContains(t, output, fmt.Sprintf(`- "%s - %s"`, echoSubCmd.CommandPath(), echoSubCmd.Short))
4242
}
4343

4444
func TestGenYamlNoTag(t *testing.T) {

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
module github.com/spf13/cobra
22

3-
go 1.15
3+
go 1.21.0
44

55
require (
66
github.com/cpuguy83/go-md2man/v2 v2.0.6
7+
github.com/goccy/go-yaml v1.17.1
78
github.com/inconshreveable/mousetrap v1.1.0
89
github.com/spf13/pflag v1.0.6
9-
gopkg.in/yaml.v3 v3.0.1
1010
)
11+
12+
require github.com/russross/blackfriday/v2 v2.1.0 // indirect

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
22
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
3+
github.com/goccy/go-yaml v1.17.1 h1:LI34wktB2xEE3ONG/2Ar54+/HJVBriAGJ55PHls4YuY=
4+
github.com/goccy/go-yaml v1.17.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
35
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
46
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
57
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
68
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
79
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
810
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
10-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
11-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12-
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)