Skip to content

Commit

Permalink
Merge pull request #3461 from acpana/acpana/lint-yaml
Browse files Browse the repository at this point in the history
lint: add depguard
  • Loading branch information
google-oss-prow[bot] authored Jan 8, 2025
2 parents 974a6ea + e68f2d2 commit eacb025
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ issues:
linters:
disable-all: true
enable:
- depguard
- errcheck
- errorlint
# - exportloopref
Expand Down Expand Up @@ -60,3 +61,9 @@ linters-settings:
- shadow
- testinggoroutine
- unusedwrite
depguard:
rules:
main:
deny:
- pkg: "github.com/ghodss/yaml"
desc: Use "sigs.k8s.io/yaml"
2 changes: 1 addition & 1 deletion config/tests/samples/create/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
testyaml "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test/yaml"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/test/controller/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/operator/pkg/k8s"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cluster"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/declarative/pkg/manifest"
Expand Down
2 changes: 1 addition & 1 deletion operator/scripts/generate-image-configmap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"path"
"strings"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion operator/scripts/utils/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"io"
"io/ioutil"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
goyaml "gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"io"
"io/ioutil"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmd/printresources/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/cli/cmd/printresources/resourcedescription"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"github.com/olekukonko/tablewriter"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/outputsink/filename/filename.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/resourceskeleton"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/servicemapping/servicemappingloader"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"github.com/gosimple/slug"
tfschema "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/outputsink/sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test"
tfprovider "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/tf/provider"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/stream/yamlstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"io"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/dynamic/common_test_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

condition "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
Expand Down
2 changes: 1 addition & 1 deletion pkg/crd/crdloader/crdloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/text"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down
2 changes: 1 addition & 1 deletion pkg/snippet/snippetgeneration/snippetgeneration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/mapslice"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
goyaml "gopkg.in/yaml.v2"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/resourcefixture/resourcefixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/test"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/unstructured.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package test
import (
"testing"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/test/yaml/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

cnrmyaml "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/yaml"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
"github.com/google/go-cmp/cmp"
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-cnrm-cluster-roles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/slice"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
rbacv1 "k8s.io/api/rbac/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-crds/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/repo"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/util/slice"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
crdgen "sigs.k8s.io/controller-tools/pkg/crd"
"sigs.k8s.io/controller-tools/pkg/genall"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-gvks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"sort"
"strings"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/parse-crds/parse-crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/crd/crdgeneration"
kccyaml "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/yaml"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/allowlist"
generatedembed "github.com/GoogleCloudPlatform/k8s-config-connector/scripts/resource-autogen/servicemapping/embed/generated"

"github.com/ghodss/yaml"
"github.com/ghodss/yaml" //nolint:depguard
)

var emptyIAMConfig v1alpha1.IAMConfig
Expand Down

0 comments on commit eacb025

Please sign in to comment.