diff --git a/.golangci.yaml b/.golangci.yaml index ad92622481dbc6..c310f876c36271 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -48,6 +48,14 @@ linters-settings: - github.com/pkg/errors: recommendations: - errors + - gopkg.in/yaml.v2: + recommendations: + - sigs.k8s.io/yaml + reason: "`sigs.k8s.io/yaml/goyaml.v2` can be used instead." + - gopkg.in/yaml.v3: + recommendations: + - sigs.k8s.io/yaml + reason: "`sigs.k8s.io/yaml/goyaml.v3` can be used instead." importas: alias: - alias: stderrors diff --git a/applicationset/utils/createOrUpdate_test.go b/applicationset/utils/createOrUpdate_test.go index de64541337178b..e0ac586f6d89e7 100644 --- a/applicationset/utils/createOrUpdate_test.go +++ b/applicationset/utils/createOrUpdate_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + yaml "sigs.k8s.io/yaml/goyaml.v3" "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" "github.com/argoproj/argo-cd/v2/util/argo/normalizers" diff --git a/cmpserver/plugin/plugin_test.go b/cmpserver/plugin/plugin_test.go index 30bd0a97bedc5e..a7b2f0e7d92e9f 100644 --- a/cmpserver/plugin/plugin_test.go +++ b/cmpserver/plugin/plugin_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/metadata" - "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/argo-cd/v2/cmpserver/apiclient" repoclient "github.com/argoproj/argo-cd/v2/reposerver/apiclient" diff --git a/commitserver/commit/hydratorhelper.go b/commitserver/commit/hydratorhelper.go index a4fbeb591b53c8..d4f6c4800bc09a 100644 --- a/commitserver/commit/hydratorhelper.go +++ b/commitserver/commit/hydratorhelper.go @@ -8,8 +8,8 @@ import ( "text/template" log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v3" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + yaml "sigs.k8s.io/yaml/goyaml.v3" "github.com/argoproj/argo-cd/v2/commitserver/apiclient" "github.com/argoproj/argo-cd/v2/util/io/files" diff --git a/go.mod b/go.mod index 2a8a1b1d6bee87..d7f541482aa8a8 100644 --- a/go.mod +++ b/go.mod @@ -93,8 +93,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 google.golang.org/grpc v1.69.2 google.golang.org/protobuf v1.36.1 - gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.31.0 k8s.io/apiextensions-apiserver v0.31.2 k8s.io/apimachinery v0.31.0 @@ -159,6 +157,8 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/retry.v1 v1.0.3 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/hack/gen-docs/main.go b/hack/gen-docs/main.go index c39f4628a432c8..621782c7a2ce56 100644 --- a/hack/gen-docs/main.go +++ b/hack/gen-docs/main.go @@ -8,8 +8,8 @@ import ( "sort" "strings" - "gopkg.in/yaml.v2" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/notifications-engine/pkg/docs" ) diff --git a/hack/gen-resources/generators/cluster_generator.go b/hack/gen-resources/generators/cluster_generator.go index ff5e03e8755fe2..789de5dccec58d 100644 --- a/hack/gen-resources/generators/cluster_generator.go +++ b/hack/gen-resources/generators/cluster_generator.go @@ -13,7 +13,7 @@ import ( "github.com/argoproj/argo-cd/v2/util/helm" - "gopkg.in/yaml.v2" + yaml "sigs.k8s.io/yaml/goyaml.v2" "k8s.io/client-go/kubernetes/scheme" diff --git a/hack/gen-resources/util/gen_options_parser.go b/hack/gen-resources/util/gen_options_parser.go index 22c36ab661a58f..d878b678de38f7 100644 --- a/hack/gen-resources/util/gen_options_parser.go +++ b/hack/gen-resources/util/gen_options_parser.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "gopkg.in/yaml.v2" + yaml "sigs.k8s.io/yaml/goyaml.v2" ) type SourceOpts struct { diff --git a/server/extension/extension.go b/server/extension/extension.go index cba62c3bb591c8..6f2cbbd19bc6c6 100644 --- a/server/extension/extension.go +++ b/server/extension/extension.go @@ -14,7 +14,7 @@ import ( "github.com/felixge/httpsnoop" log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v3" + yaml "sigs.k8s.io/yaml/goyaml.v3" "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" applisters "github.com/argoproj/argo-cd/v2/pkg/client/listers/application/v1alpha1" diff --git a/server/server.go b/server/server.go index 29c7da2ab1552f..93597d8256eb5e 100644 --- a/server/server.go +++ b/server/server.go @@ -53,7 +53,6 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" - "gopkg.in/yaml.v2" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -62,6 +61,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" "sigs.k8s.io/controller-runtime/pkg/client" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/argo-cd/v2/common" "github.com/argoproj/argo-cd/v2/pkg/apiclient" diff --git a/test/e2e/fixture/admin/utils/backup.go b/test/e2e/fixture/admin/utils/backup.go index 79bd8905186035..52ab65908c60ec 100644 --- a/test/e2e/fixture/admin/utils/backup.go +++ b/test/e2e/fixture/admin/utils/backup.go @@ -5,8 +5,8 @@ import ( "strings" kube "github.com/argoproj/gitops-engine/pkg/utils/kube" - yaml "gopkg.in/yaml.v3" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + yaml "sigs.k8s.io/yaml/goyaml.v3" ) type ExportedResources []unstructured.Unstructured diff --git a/util/argo/resource_tracking_test.go b/util/argo/resource_tracking_test.go index 1616c1abce9a62..1374ed22228d10 100644 --- a/util/argo/resource_tracking_test.go +++ b/util/argo/resource_tracking_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/argo-cd/v2/common" ) diff --git a/util/helm/client.go b/util/helm/client.go index d9972adb04968d..a6806bb23df4d3 100644 --- a/util/helm/client.go +++ b/util/helm/client.go @@ -22,10 +22,10 @@ import ( "github.com/argoproj/pkg/sync" log "github.com/sirupsen/logrus" - "gopkg.in/yaml.v2" "oras.land/oras-go/v2/registry/remote" "oras.land/oras-go/v2/registry/remote/auth" "oras.land/oras-go/v2/registry/remote/credentials" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/argo-cd/v2/util/cache" argoio "github.com/argoproj/argo-cd/v2/util/io" diff --git a/util/helm/client_test.go b/util/helm/client_test.go index 00362ee06b6992..28d28adcf1d9ce 100644 --- a/util/helm/client_test.go +++ b/util/helm/client_test.go @@ -15,7 +15,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + yaml "sigs.k8s.io/yaml/goyaml.v2" "github.com/argoproj/argo-cd/v2/util/io" )