Skip to content

Commit

Permalink
chore: use sigs.k8s.io/yaml only to handle yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Dec 21, 2024
1 parent 0b542ba commit 12ab00e
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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."
perfsprint:
# Optimizes even if it requires an int or uint type cast.
int-conversion: true
Expand Down
2 changes: 1 addition & 1 deletion applicationset/utils/createOrUpdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmpserver/plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion commitserver/commit/hydratorhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28
google.golang.org/grpc v1.69.0
google.golang.org/protobuf v1.36.0
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
Expand Down Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion hack/gen-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion hack/gen-resources/generators/cluster_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion hack/gen-resources/util/gen_options_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

"gopkg.in/yaml.v2"
yaml "sigs.k8s.io/yaml/goyaml.v2"
)

type SourceOpts struct {
Expand Down
2 changes: 1 addition & 1 deletion server/extension/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixture/admin/utils/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion util/argo/resource_tracking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion util/helm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion util/helm/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 12ab00e

Please sign in to comment.