Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce gci to unify the order of package import #2545

Merged
merged 2 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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