Skip to content

Commit

Permalink
feat: introduce gci to unify the order of package import (#2545)
Browse files Browse the repository at this point in the history
Introduce gci to unify the order of package import

Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
  • Loading branch information
Fish-pro and ritazh committed Jan 31, 2023
1 parent 5ab923e commit 4a27fbf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ linters:
- errorlint
- exportloopref
- forcetypeassert
- gci
- gocritic
- goconst
- godot
Expand Down
5 changes: 1 addition & 4 deletions cmd/gator/expand/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import (
"github.com/open-policy-agent/gatekeeper/pkg/gator/expand"
"github.com/open-policy-agent/gatekeeper/pkg/gator/reader"
"github.com/spf13/cobra"

// yaml.v3 inserts a space before '-', which is inconsistent with standard
// kubernetes and kubebuilder format. yaml.v2 does not insert these spaces.
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v2" // yaml.v3 inserts a space before '-', which is inconsistent with standard, kubernetes and kubebuilder format. yaml.v2 does not insert these spaces.
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

Expand Down
6 changes: 2 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import (
"path/filepath"
"time"

"github.com/open-policy-agent/gatekeeper/pkg/expansion"
// set GOMAXPROCS to the number of container cores, if known.
_ "go.uber.org/automaxprocs"

"github.com/go-logr/zapr"
"github.com/open-policy-agent/cert-controller/pkg/rotator"
constraintclient "github.com/open-policy-agent/frameworks/constraint/pkg/client"
Expand All @@ -44,6 +40,7 @@ import (
"github.com/open-policy-agent/gatekeeper/pkg/audit"
"github.com/open-policy-agent/gatekeeper/pkg/controller"
"github.com/open-policy-agent/gatekeeper/pkg/controller/config/process"
"github.com/open-policy-agent/gatekeeper/pkg/expansion"
"github.com/open-policy-agent/gatekeeper/pkg/externaldata"
"github.com/open-policy-agent/gatekeeper/pkg/metrics"
"github.com/open-policy-agent/gatekeeper/pkg/mutation"
Expand All @@ -56,6 +53,7 @@ import (
"github.com/open-policy-agent/gatekeeper/pkg/watch"
"github.com/open-policy-agent/gatekeeper/pkg/webhook"
"github.com/open-policy-agent/gatekeeper/third_party/sigs.k8s.io/controller-runtime/pkg/dynamiccache"
_ "go.uber.org/automaxprocs" // set GOMAXPROCS to the number of container cores, if known.
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/config/config_controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"path/filepath"
"testing"

"github.com/open-policy-agent/gatekeeper/apis"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
Expand All @@ -30,8 +31,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/open-policy-agent/gatekeeper/apis"
)

var cfg *rest.Config
Expand Down

0 comments on commit 4a27fbf

Please sign in to comment.