Skip to content

Commit

Permalink
Reformat all imports using gci linter. (kubernetes-sigs#3159)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbobrovskyi authored and kannon92 committed Nov 19, 2024
1 parent c81d2ab commit 21476db
Show file tree
Hide file tree
Showing 48 changed files with 74 additions and 71 deletions.
12 changes: 9 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ linters-settings:
disabled-checks:
- appendAssign
- exitAfterDefer
goimports:
local-prefixes: sigs.k8s.io/kueue
govet:
enable:
- nilness
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(sigs.k8s.io/kueue) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports.
skip-generated: true # Skip generated files.
perfsprint:
int-conversion: false
errorf: true
Expand All @@ -34,9 +40,9 @@ linters:
- dupword
- durationcheck
- fatcontext
- gci
- ginkgolinter
- gocritic
- goimports
- govet
- loggercheck
- misspell
Expand Down
12 changes: 9 additions & 3 deletions cmd/experimental/kjobctl/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ linters-settings:
disabled-checks:
- appendAssign
- exitAfterDefer
goimports:
local-prefixes: sigs.k8s.io/kueue
govet:
enable:
- nilness
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(sigs.k8s.io/kueue/cmd/experimental/kjobctl) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports.
skip-generated: true # Skip generated files.
perfsprint:
int-conversion: false
errorf: true
Expand All @@ -32,9 +38,9 @@ linters:
- copyloopvar
- dupword
- durationcheck
- gci
- ginkgolinter
- gocritic
- goimports
- govet
- loggercheck
- misspell
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import (
"k8s.io/apimachinery/pkg/runtime"
k8s "k8s.io/client-go/kubernetes"
"k8s.io/utils/ptr"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
k8sfake "k8s.io/client-go/kubernetes/fake"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
kjobctlfake "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
cmdtesting "sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/testing"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/testing/wrappers"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

func TestInteractiveBuilder(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/builder/job_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/utils/ptr"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
kjobctlfake "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
cmdtesting "sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/testing"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/testing/wrappers"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

func TestJobBuilder(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
kjobctlfake "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
cmdtesting "sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/testing"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/testing/wrappers"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

func TestRayClusterBuilder(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion cmd/experimental/kjobctl/pkg/builder/ray_job_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
rayutil "github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
kjobctlfake "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
cmdtesting "sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/testing"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/testing/wrappers"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

func TestRayJobBuilder(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
k8sfake "k8s.io/client-go/kubernetes/fake"

"sigs.k8s.io/kueue/apis/kueue/v1beta1"
kueuefake "sigs.k8s.io/kueue/client-go/clientset/versioned/fake"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
cmdtesting "sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/testing"
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/kubectl/pkg/util/templates"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/completion"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
"k8s.io/apimachinery/pkg/util/duration"
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type listInteractivePrinter struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (
batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
"k8s.io/kubectl/pkg/util/templates"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/completion"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_job_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/utils/clock"
"k8s.io/utils/ptr"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type listJobPrinter struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_ray_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/kubectl/pkg/util/templates"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/completion"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
"k8s.io/apimachinery/pkg/util/duration"
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type listRayClusterPrinter struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_ray_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import (
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/kubectl/pkg/util/templates"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/completion"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"k8s.io/apimachinery/pkg/util/duration"
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

type listRayJobPrinter struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/list/list_slurm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (
batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
"k8s.io/kubectl/pkg/util/templates"
"k8s.io/utils/clock"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/completion"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/experimental/kjobctl/pkg/cmd/testing/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/tools/clientcmd"

kueueversioned "sigs.k8s.io/kueue/client-go/clientset/versioned"

kjobctlversioned "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned"
kjobctlfake "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned/fake"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd/util"
Expand Down
5 changes: 3 additions & 2 deletions cmd/experimental/kjobctl/pkg/cmd/util/client_getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ import (
"k8s.io/cli-runtime/pkg/resource"
"k8s.io/client-go/dynamic"
k8s "k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"

kueueversioned "sigs.k8s.io/kueue/client-go/clientset/versioned"

kjobctlversioned "sigs.k8s.io/kueue/cmd/experimental/kjobctl/client-go/clientset/versioned"

_ "k8s.io/client-go/plugin/pkg/client/auth"
)

type ClientGetter interface {
Expand Down
3 changes: 1 addition & 2 deletions cmd/experimental/kjobctl/pkg/cmd/util/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ limitations under the License.
package util

import (
"k8s.io/klog/v2"

"github.com/spf13/cobra"
"k8s.io/klog/v2"
)

func AddFieldSelectorFlagVar(cmd *cobra.Command, p *string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ package wrappers
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

// ConfigMapWrapper wraps a ConfigMap.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

// JobWrapper wraps a Job.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

// PodWrapper wraps a Pod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

// RayClusterWrapper wraps a RayCluster.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
rayutil "github.com/ray-project/kuberay/ray-operator/controllers/ray/utils"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

// RayJobWrapper wraps a RayJob.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import (
testingclock "k8s.io/utils/clock/testing"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"

"sigs.k8s.io/kueue/cmd/experimental/kjobctl/apis/v1alpha1"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/cmd"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/constants"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/pkg/testing/wrappers"
"sigs.k8s.io/kueue/cmd/experimental/kjobctl/test/util"
kueueconstants "sigs.k8s.io/kueue/pkg/controller/constants"
)

var _ = ginkgo.Describe("Kjobctl Create", ginkgo.Ordered, ginkgo.ContinueOnFailure, func() {
Expand Down
Loading

0 comments on commit 21476db

Please sign in to comment.