diff --git a/doc/cmd_test.go b/doc/cmd_test.go index 0d022c77d..9118e1b04 100644 --- a/doc/cmd_test.go +++ b/doc/cmd_test.go @@ -94,7 +94,7 @@ var dummyCmd = &cobra.Command{ func checkStringContains(t *testing.T, got, expected string) { if !strings.Contains(got, expected) { - t.Errorf("Expected to contain: \n %v\nGot:\n %v\n", expected, got) + t.Errorf("Expected string to contain: \n %v\nGot:\n %v\n", expected, got) } } diff --git a/doc/yaml_docs.go b/doc/yaml_docs.go index 2b26d6ec0..709074ab5 100644 --- a/doc/yaml_docs.go +++ b/doc/yaml_docs.go @@ -22,9 +22,9 @@ import ( "sort" "strings" + yaml "github.com/goccy/go-yaml" "github.com/spf13/cobra" "github.com/spf13/pflag" - "gopkg.in/yaml.v3" ) type cmdOption struct { diff --git a/doc/yaml_docs_test.go b/doc/yaml_docs_test.go index ddd4e24e1..eedaea371 100644 --- a/doc/yaml_docs_test.go +++ b/doc/yaml_docs_test.go @@ -38,7 +38,7 @@ func TestGenYamlDoc(t *testing.T) { checkStringContains(t, output, "rootflag") checkStringContains(t, output, rootCmd.Short) checkStringContains(t, output, echoSubCmd.Short) - checkStringContains(t, output, fmt.Sprintf("- %s - %s", echoSubCmd.CommandPath(), echoSubCmd.Short)) + checkStringContains(t, output, fmt.Sprintf(`- "%s - %s"`, echoSubCmd.CommandPath(), echoSubCmd.Short)) } func TestGenYamlNoTag(t *testing.T) { diff --git a/go.mod b/go.mod index 4a6fda792..c55dcfb7a 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ module github.com/spf13/cobra -go 1.15 +go 1.21.0 require ( github.com/cpuguy83/go-md2man/v2 v2.0.6 + github.com/goccy/go-yaml v1.17.1 github.com/inconshreveable/mousetrap v1.1.0 github.com/spf13/pflag v1.0.6 - gopkg.in/yaml.v3 v3.0.1 ) + +require github.com/russross/blackfriday/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index 30ef25c78..45cf20ab3 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,10 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/goccy/go-yaml v1.17.1 h1:LI34wktB2xEE3ONG/2Ar54+/HJVBriAGJ55PHls4YuY= +github.com/goccy/go-yaml v1.17.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=