diff --git a/core/printer.go b/core/printer.go index 54511f9c31..862fab088e 100644 --- a/core/printer.go +++ b/core/printer.go @@ -9,9 +9,9 @@ import ( "strings" "text/template" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core/human" "github.com/scaleway/scaleway-cli/v2/internal/gofields" - "gopkg.in/yaml.v3" ) // Type defines an formatter format. @@ -292,7 +292,7 @@ func (p *Printer) printJSON(data any) error { } func (p *Printer) printYAML(data any) error { - _, implementMarshaler := data.(yaml.Marshaler) + _, implementMarshaler := data.(yaml.BytesMarshaler) err, isError := data.(error) if isError && !implementMarshaler { diff --git a/go.mod b/go.mod index b246bdd5a1..6e259006dc 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.18.0 github.com/getsentry/sentry-go v0.39.0 - github.com/ghodss/yaml v1.0.0 + github.com/goccy/go-yaml v1.18.0 github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 github.com/hashicorp/go-version v1.7.0 github.com/karrick/tparse/v2 v2.8.2 @@ -32,7 +32,6 @@ require ( golang.org/x/sync v0.18.0 golang.org/x/term v0.37.0 golang.org/x/text v0.31.0 - gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -212,6 +211,7 @@ require ( gopkg.in/dnaeon/go-vcr.v4 v4.0.6 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/gotestsum v1.12.3 // indirect ) diff --git a/go.sum b/go.sum index 1c6978e6e1..615cad6124 100644 --- a/go.sum +++ b/go.sum @@ -235,8 +235,6 @@ github.com/gdamore/tcell/v2 v2.9.0 h1:N6t+eqK7/xwtRPwxzs1PXeRWnm0H9l02CrgJ7DLn1y github.com/gdamore/tcell/v2 v2.9.0/go.mod h1:8/ZoqM9rxzYphT9tH/9LnunhV9oPBqwS8WHGYm5nrmo= github.com/getsentry/sentry-go v0.39.0 h1:uhnexj8PNCyCve37GSqxXOeXHh4cJNLNNB4w70Jtgo0= github.com/getsentry/sentry-go v0.39.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= @@ -260,6 +258,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= +github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= diff --git a/internal/config/config.go b/internal/config/config.go index caedeb848f..bcc69f50ae 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,9 +8,9 @@ import ( "runtime" "text/template" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/internal/alias" "github.com/scaleway/scaleway-sdk-go/scw" - "gopkg.in/yaml.v3" ) const ( diff --git a/internal/editor/marshal.go b/internal/editor/marshal.go index 53ddab9cb9..1d9f190abc 100644 --- a/internal/editor/marshal.go +++ b/internal/editor/marshal.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" ) type MarshalMode = string diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig.go b/internal/namespaces/k8s/v1/custom_kubeconfig.go index 343754a094..23515f0614 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig.go @@ -10,7 +10,7 @@ import ( "runtime" "strings" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" "github.com/scaleway/scaleway-sdk-go/scw" diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig_get.go b/internal/namespaces/k8s/v1/custom_kubeconfig_get.go index 531d2d4235..04d8c145db 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig_get.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig_get.go @@ -4,7 +4,7 @@ import ( "context" "reflect" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" k8s "github.com/scaleway/scaleway-sdk-go/api/k8s/v1" diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig_get_test.go b/internal/namespaces/k8s/v1/custom_kubeconfig_get_test.go index 0fe4cded6a..fd7cd85d3b 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig_get_test.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig_get_test.go @@ -4,7 +4,7 @@ import ( "regexp" "testing" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig_install.go b/internal/namespaces/k8s/v1/custom_kubeconfig_install.go index 06abf5cbb1..7aea33cb90 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig_install.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig_install.go @@ -6,7 +6,7 @@ import ( "os" "reflect" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" k8s "github.com/scaleway/scaleway-sdk-go/api/k8s/v1" diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig_install_test.go b/internal/namespaces/k8s/v1/custom_kubeconfig_install_test.go index 3ef55a1ecc..01a739c262 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig_install_test.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig_install_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" diff --git a/internal/namespaces/k8s/v1/custom_kubeconfig_uninstall_test.go b/internal/namespaces/k8s/v1/custom_kubeconfig_uninstall_test.go index cad5b5990b..296043c2b0 100644 --- a/internal/namespaces/k8s/v1/custom_kubeconfig_uninstall_test.go +++ b/internal/namespaces/k8s/v1/custom_kubeconfig_uninstall_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1" api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" diff --git a/internal/namespaces/k8s/v1/helpers_test.go b/internal/namespaces/k8s/v1/helpers_test.go index a6ec99f5d7..8d0222230e 100644 --- a/internal/namespaces/k8s/v1/helpers_test.go +++ b/internal/namespaces/k8s/v1/helpers_test.go @@ -7,7 +7,7 @@ import ( "path" "strings" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" go_api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" k8s "github.com/scaleway/scaleway-sdk-go/api/k8s/v1" diff --git a/internal/namespaces/lb/v1/helper_test.go b/internal/namespaces/lb/v1/helper_test.go index f7ee214fe4..fa3e7ec662 100644 --- a/internal/namespaces/lb/v1/helper_test.go +++ b/internal/namespaces/lb/v1/helper_test.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/scaleway/scaleway-cli/v2/core" go_api "github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1/types" "github.com/scaleway/scaleway-sdk-go/api/k8s/v1"