add gci to seperate goimports to three parts

Signed-off-by: wuyingjun <wuyingjun_yewu@cmss.chinamobile.com>
This commit is contained in:
wuyingjun 2022-06-30 15:58:10 +08:00
parent cee1a2f4a1
commit d6b4fac842
2 changed files with 17 additions and 2 deletions

View File

@ -42,6 +42,7 @@ linters:
- unused - unused
- varcheck - varcheck
# other linters supported by golangci-lint. # other linters supported by golangci-lint.
- gci
- gocyclo - gocyclo
- gosec - gosec
- whitespace - whitespace
@ -53,6 +54,11 @@ linters-settings:
gocyclo: gocyclo:
# minimal cyclomatic complexity to report # minimal cyclomatic complexity to report
min-complexity: 15 min-complexity: 15
gci:
sections:
- Standard
- Default
- Prefix(github.com/karmada-io/karmada)
issues: issues:
# The list of ids of default excludes to include or disable. By default it's empty. # The list of ids of default excludes to include or disable. By default it's empty.
@ -62,3 +68,12 @@ issues:
- EXC0012 - EXC0012
- EXC0013 - EXC0013
- EXC0014 - EXC0014
exclude-rules:
# Exclude 'cmd/agent/main.go' and 'cmd/controller-manager/controller-manager.go'
# because 'sigs.k8s.io/controller-runtime/pkg/metrics' package should be set before 'k8s.io/apiserver/pkg/server' .
- path: cmd/agent/main.go
linters:
- gci
- path: cmd/controller-manager/controller-manager.go
linters:
- gci

View File

@ -1,9 +1,9 @@
package kubernetes package kubernetes
import ( import (
"github.com/karmada-io/karmada/pkg/karmadactl/cmdinit/utils"
rbacv1 "k8s.io/api/rbac/v1" rbacv1 "k8s.io/api/rbac/v1"
"github.com/karmada-io/karmada/pkg/karmadactl/cmdinit/utils"
) )
// CreateControllerManagerRBAC karmada-controller-manager ClusterRole and ClusterRoleBinding // CreateControllerManagerRBAC karmada-controller-manager ClusterRole and ClusterRoleBinding