From c922a6d3c02e545ad432b2e79aa7d078dbd898ef Mon Sep 17 00:00:00 2001 From: Fred Rolland Date: Wed, 27 Apr 2022 12:00:20 +0300 Subject: [PATCH] Fix whitespace lint This commit fix the issues found by: `golangci-lint run --disable-all -E whitespace` Signed-off-by: Fred Rolland --- cmd/webhook/start.go | 1 - controllers/sriovnetworknodepolicy_controller.go | 1 - pkg/apply/merge.go | 2 -- pkg/daemon/daemon.go | 1 - pkg/plugins/mellanox/mellanox_plugin.go | 1 - pkg/utils/utils.go | 1 - pkg/webhook/validate.go | 2 -- test/conformance/test_suite_test.go | 1 - test/conformance/tests/init.go | 1 - test/conformance/tests/sriov_operator.go | 3 --- test/util/cluster/cluster.go | 1 - test/util/k8sreporter/reporter.go | 1 - test/util/util.go | 3 --- test/validation/test_suite_test.go | 1 - 14 files changed, 20 deletions(-) diff --git a/cmd/webhook/start.go b/cmd/webhook/start.go index a0046e383..aec19d0cb 100644 --- a/cmd/webhook/start.go +++ b/cmd/webhook/start.go @@ -209,5 +209,4 @@ func runStartCmd(cmd *cobra.Command, args []string) { glog.Infof("watcher error: %v", err) } } - } diff --git a/controllers/sriovnetworknodepolicy_controller.go b/controllers/sriovnetworknodepolicy_controller.go index 39571c0a6..26b65fba4 100644 --- a/controllers/sriovnetworknodepolicy_controller.go +++ b/controllers/sriovnetworknodepolicy_controller.go @@ -118,7 +118,6 @@ func (r *SriovNetworkNodePolicyReconciler) Reconcile(ctx context.Context, req ct if len(defaultOpConf.Spec.ConfigDaemonNodeSelector) > 0 { labels := client.MatchingLabels(defaultOpConf.Spec.ConfigDaemonNodeSelector) lo = &labels - } else { lo = &client.MatchingLabels{ "node-role.kubernetes.io/worker": "", diff --git a/pkg/apply/merge.go b/pkg/apply/merge.go index f7ca9ebde..7ea18ae3c 100644 --- a/pkg/apply/merge.go +++ b/pkg/apply/merge.go @@ -10,7 +10,6 @@ import ( // This is to be able to do a a meaningful comparison in apply, // since objects created on runtime do not have these fields populated. func MergeMetadataForUpdate(current, updated *uns.Unstructured) error { - mergeAnnotations(current, updated) mergeLabels(current, updated) updated.SetResourceVersion(current.GetResourceVersion()) @@ -51,7 +50,6 @@ const ( func MergeDeploymentForUpdate(current, updated *uns.Unstructured) error { gvk := updated.GroupVersionKind() if gvk.Group == "apps" && gvk.Kind == "Deployment" { - // Copy over the revision annotation from current up to updated // otherwise, updated would win, and this annotation is "special" and // needs to be preserved diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 165b0936d..5b0dc6cea 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -506,7 +506,6 @@ func (dn *Daemon) nodeStateSyncHandler(generation int64) error { done := make(chan bool) go dn.getDrainLock(ctx, done) <-done - } if utils.ClusterType == utils.ClusterTypeOpenshift { diff --git a/pkg/plugins/mellanox/mellanox_plugin.go b/pkg/plugins/mellanox/mellanox_plugin.go index 27f52c5ef..ac57b2cff 100644 --- a/pkg/plugins/mellanox/mellanox_plugin.go +++ b/pkg/plugins/mellanox/mellanox_plugin.go @@ -351,7 +351,6 @@ func getOtherPortSpec(pciAddress string) *sriovnetworkv1.Interface { // handleTotalVfs return required total VFs or max (required VFs for dual port NIC) and needReboot if totalVfs will change func handleTotalVfs(fwCurrent, fwNext, attrs *mlnxNic, ifaceSpec sriovnetworkv1.Interface, isDualPort bool) ( totalVfs int, needReboot, changeWithoutReboot bool) { - totalVfs = ifaceSpec.NumVfs // Check if the other port is changing the number of VF if isDualPort { diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 14b53a5a3..259988621 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -325,7 +325,6 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor glog.Errorf("configSriovDevice(): VF link is not ready for device %s %q", addr, err) return err } - } if err = setVfAdminMac(addr, pfLink, vfLink); err != nil { glog.Errorf("configSriovDevice(): fail to configure VF admin mac address for device %s %q", addr, err) diff --git a/pkg/webhook/validate.go b/pkg/webhook/validate.go index 4c86fd4e7..56e6b260b 100644 --- a/pkg/webhook/validate.go +++ b/pkg/webhook/validate.go @@ -74,13 +74,11 @@ func validateSriovNetworkNodePolicy(cr *sriovnetworkv1.SriovNetworkNodePolicy, o admit, err := staticValidateSriovNetworkNodePolicy(cr) if err != nil { return admit, warnings, err - } admit, err = dynamicValidateSriovNetworkNodePolicy(cr) if err != nil { return admit, warnings, err - } return admit, warnings, nil diff --git a/test/conformance/test_suite_test.go b/test/conformance/test_suite_test.go index e162ed38c..8ee570d80 100644 --- a/test/conformance/test_suite_test.go +++ b/test/conformance/test_suite_test.go @@ -48,7 +48,6 @@ func TestTest(t *testing.T) { } defer f.Close() rr = append(rr, k8sreporter.New(clients, f)) - } else if *dumpOutput { rr = append(rr, k8sreporter.New(clients, os.Stdout)) } diff --git a/test/conformance/tests/init.go b/test/conformance/tests/init.go index 4a212230d..56b836dd9 100644 --- a/test/conformance/tests/init.go +++ b/test/conformance/tests/init.go @@ -18,5 +18,4 @@ func init() { } clients = testclient.New("") - } diff --git a/test/conformance/tests/sriov_operator.go b/test/conformance/tests/sriov_operator.go index bc1b04598..a20578a4d 100644 --- a/test/conformance/tests/sriov_operator.go +++ b/test/conformance/tests/sriov_operator.go @@ -1787,7 +1787,6 @@ func findSuitableResourceForMain(mainIntf *sriovv1.InterfaceExt, networkState *s } return "", false - } func resourceOnlyForInterface(networkState *sriovv1.SriovNetworkNodeState, resourceName, interfaceName string) bool { @@ -1961,7 +1960,6 @@ func daemonsScheduledOnNodes(selector string) bool { } } return true - } func createSriovPolicy(sriovDevice string, testNode string, numVfs int, resourceName string) { @@ -2186,6 +2184,5 @@ func setSriovOperatorSpecFlag(flagName string, flagValue bool) { return true }, 1*time.Minute, 10*time.Second).Should(BeTrue()) - } } diff --git a/test/util/cluster/cluster.go b/test/util/cluster/cluster.go index 7bd0b8e9a..388345fd9 100644 --- a/test/util/cluster/cluster.go +++ b/test/util/cluster/cluster.go @@ -98,7 +98,6 @@ func (n *EnabledNodes) FindOneSriovDevice(node string) (*sriovv1.InterfaceExt, e } for _, itf := range s.Status.Interfaces { if IsPFDriverSupported(itf.Driver) && sriovv1.IsSupportedDevice(itf.DeviceID) { - // Skip mlx interfaces if secure boot is enabled // TODO: remove this when mlx support secure boot/lockdown mode if itf.Vendor == mlxVendorID && n.IsSecureBootEnabled[node] { diff --git a/test/util/k8sreporter/reporter.go b/test/util/k8sreporter/reporter.go index da8716b7c..e13e794e2 100644 --- a/test/util/k8sreporter/reporter.go +++ b/test/util/k8sreporter/reporter.go @@ -51,7 +51,6 @@ func (r *KubernetesReporter) SpecDidComplete(specSummary *types.SpecSummary) { fmt.Fprintln(r.dumpOutput, "Starting dump for failed spec", specSummary.ComponentTexts) r.Dump() fmt.Fprintln(r.dumpOutput, "Finished dump for failed spec") - } func (r *KubernetesReporter) Dump() { diff --git a/test/util/util.go b/test/util/util.go index cdf4ed5cf..b47779d46 100644 --- a/test/util/util.go +++ b/test/util/util.go @@ -58,7 +58,6 @@ func WaitForSriovNetworkNodeStateReady(nodeState *sriovnetworkv1.SriovNetworkNod } func WaitForDaemonSetReady(ds *appsv1.DaemonSet, client client.Client, namespace, name string, retryInterval, timeout time.Duration) error { - err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { ctx, cancel := goctx.WithTimeout(goctx.Background(), ApiTimeout) defer cancel() @@ -84,7 +83,6 @@ func WaitForDaemonSetReady(ds *appsv1.DaemonSet, client client.Client, namespace } func WaitForNamespacedObject(obj client.Object, client client.Client, namespace, name string, retryInterval, timeout time.Duration) error { - err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { ctx, cancel := goctx.WithTimeout(goctx.Background(), ApiTimeout) defer cancel() @@ -106,7 +104,6 @@ func WaitForNamespacedObject(obj client.Object, client client.Client, namespace, } func WaitForNamespacedObjectDeleted(obj client.Object, client client.Client, namespace, name string, retryInterval, timeout time.Duration) error { - err := wait.PollImmediate(retryInterval, timeout, func() (done bool, err error) { ctx, cancel := goctx.WithTimeout(goctx.Background(), ApiTimeout) defer cancel() diff --git a/test/validation/test_suite_test.go b/test/validation/test_suite_test.go index c7e85bab2..e2c0d29b5 100644 --- a/test/validation/test_suite_test.go +++ b/test/validation/test_suite_test.go @@ -46,7 +46,6 @@ func TestTest(t *testing.T) { } defer f.Close() rr = append(rr, k8sreporter.New(clients, f)) - } else if *dumpOutput { rr = append(rr, k8sreporter.New(clients, os.Stdout)) }