Skip to content

Commit

Permalink
fix golangci lint config and goimports
Browse files Browse the repository at this point in the history
  • Loading branch information
tariq1890 committed Mar 7, 2023
1 parent 13405c5 commit dc86eed
Show file tree
Hide file tree
Showing 34 changed files with 101 additions and 82 deletions.
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ run:
- deployment/
- doc/
- bindata/
- pkg/client
linters-settings:
depguard:
list-type: blacklist
Expand Down Expand Up @@ -46,7 +47,7 @@ linters-settings:
gocyclo:
min-complexity: 15
goimports:
local-prefixes: github.com/k8snetworkplumbingwg/sriov-network-device-plugin
local-prefixes: github.com/k8snetworkplumbingwg/sriov-network-operator
gomnd:
settings:
mnd:
Expand Down
4 changes: 2 additions & 2 deletions api/v1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strconv"
"strings"

netattdefv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -19,8 +20,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

netattdefv1 "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/apis/k8s.cni.cncf.io/v1"
render "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion api/v1/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

v1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var update = flag.Bool("updategolden", false, "update .golden files")
Expand Down
15 changes: 7 additions & 8 deletions cmd/sriov-network-config-daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ import (
"strings"
"time"

configv1 "github.com/openshift/api/config/v1"

"github.com/golang/glog"
sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
snclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/daemon"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/utils"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/version"
configv1 "github.com/openshift/api/config/v1"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/spf13/cobra"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand All @@ -26,7 +21,11 @@ import (
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/connrotation"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
snclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/daemon"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/utils"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/version"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cmd/sriov-network-config-daemon/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"flag"
"fmt"

"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/version"
"github.com/spf13/cobra"

"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/version"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion controllers/sriovibnetwork_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
. "github.com/onsi/gomega"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
util "github.com/k8snetworkplumbingwg/sriov-network-operator/test/util"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util"
)

var _ = Describe("SriovIBNetwork Controller", func() {
Expand Down
2 changes: 1 addition & 1 deletion controllers/sriovnetwork_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
. "github.com/onsi/gomega"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
util "github.com/k8snetworkplumbingwg/sriov-network-operator/test/util"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util"
)

const on = "on"
Expand Down
2 changes: 1 addition & 1 deletion controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/apply"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
render "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
)

// SriovNetworkNodePolicyReconciler reconciles a SriovNetworkNodePolicy object
Expand Down
10 changes: 5 additions & 5 deletions controllers/sriovnetworknodepolicy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"encoding/json"
"testing"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
v1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
corev1 "k8s.io/api/core/v1"

"github.com/google/go-cmp/cmp"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
corev1 "k8s.io/api/core/v1"

dptypes "github.com/k8snetworkplumbingwg/sriov-network-device-plugin/pkg/types"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
v1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
)

func TestNodeSelectorMerge(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions controllers/sriovnetworkpoolconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"reflect"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -16,9 +17,8 @@ import (

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
render "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
utils "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/utils"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/render"
"github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/utils"
)

// SriovNetworkPoolConfigReconciler reconciles a SriovNetworkPoolConfig object
Expand Down
3 changes: 2 additions & 1 deletion controllers/sriovnetworkpoolconfig_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
)

var _ = Describe("Operator", func() {
Expand Down
7 changes: 4 additions & 3 deletions pkg/client/informers/externalversions/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/client/informers/externalversions/generic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/client/listers/sriovnetwork/v1/sriovnetwork.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/client/listers/sriovnetwork/v1/sriovnetworknodepolicy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/client/listers/sriovnetwork/v1/sriovnetworknodestate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/client/listers/sriovnetwork/v1/sriovoperatorconfig.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pkg/daemon/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"path"
"testing"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/fakefilesystem"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fakek8s "k8s.io/client-go/kubernetes/fake"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
"github.com/k8snetworkplumbingwg/sriov-network-operator/test/util/fakefilesystem"

snclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned"
fakesnclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned/fake"
plugin "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/plugins"
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/mellanox/mellanox_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/golang/glog"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
plugin "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/plugins"
Expand Down
1 change: 1 addition & 0 deletions pkg/plugins/virtual/virtual_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"reflect"

"github.com/golang/glog"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
plugin "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/plugins"
Expand Down
3 changes: 1 addition & 2 deletions pkg/utils/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package utils
import (
"context"

snclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned"
admv1 "k8s.io/api/admissionregistration/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"k8s.io/client-go/kubernetes"
ctrl "sigs.k8s.io/controller-runtime"
conf "sigs.k8s.io/controller-runtime/pkg/client/config"

sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
snclientset "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/client/clientset/versioned"
constants "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/consts"
)

Expand Down
Loading

0 comments on commit dc86eed

Please sign in to comment.