From 1b765fe0380db5de24fb72b7c0e4ad3d7c700578 Mon Sep 17 00:00:00 2001 From: AmitRoushan Date: Thu, 19 Aug 2021 09:09:07 +0530 Subject: [PATCH] fixed go formatting --- src/csi/driver/driver.go | 11 ++++++----- src/csi/main.go | 6 +++--- src/utils/k8sutils/k8sutils.go | 10 +++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/csi/driver/driver.go b/src/csi/driver/driver.go index 9ddc6356..732a8446 100644 --- a/src/csi/driver/driver.go +++ b/src/csi/driver/driver.go @@ -1,6 +1,7 @@ package driver -import( +import ( + "strings" "utils/k8sutils" ) @@ -10,17 +11,17 @@ type Driver struct { useMultiPath bool isNeedMultiPath bool k8sUtils k8sutils.Interface - nodeName string + nodeName string } func NewDriver(name, version string, useMultiPath, isNeedMultiPath bool, - k8sUtils k8sutils.Interface, nodeName string) *Driver { + k8sUtils k8sutils.Interface, nodeName string) *Driver { return &Driver{ name: name, version: version, useMultiPath: useMultiPath, isNeedMultiPath: isNeedMultiPath, - k8sUtils: k8sUtils, - nodeName: nodeName, + k8sUtils: k8sUtils, + nodeName: strings.TrimSpace(nodeName), } } diff --git a/src/csi/main.go b/src/csi/main.go index db0d7378..f2f6e135 100644 --- a/src/csi/main.go +++ b/src/csi/main.go @@ -14,8 +14,8 @@ import ( "runtime/debug" "time" "utils" - "utils/log" "utils/k8sutils" + "utils/log" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/sirupsen/logrus" @@ -32,7 +32,7 @@ const ( csiVersion = "2.2.13" defaultDriverName = "csi.huawei.com" - nodeNameEnv = "CSI_ESDK_NODENAME" + nodeNameEnv = "CSI_ESDK_NODENAME" ) var ( @@ -73,7 +73,7 @@ type CSIConfig struct { } type CSISecret struct { - Secrets map[string]interface{} `json:"secrets"` + Secrets map[string]interface{} `json:"secrets"` } func init() { diff --git a/src/utils/k8sutils/k8sutils.go b/src/utils/k8sutils/k8sutils.go index 75712b7e..a2835a5c 100644 --- a/src/utils/k8sutils/k8sutils.go +++ b/src/utils/k8sutils/k8sutils.go @@ -13,7 +13,7 @@ import ( ) const ( - topologyRegx = "topology.*" + topologyRegx = "topology.*" ) type Interface interface { @@ -21,7 +21,7 @@ type Interface interface { } type KubeClient struct { - clientSet *kubernetes.Clientset + clientSet *kubernetes.Clientset } func NewK8SUtils(kubeConfig string) (Interface, error) { @@ -49,8 +49,8 @@ func NewK8SUtils(kubeConfig string) (Interface, error) { } } - return &KubeClient{ - clientSet: clientset, + return &KubeClient{ + clientSet: clientset, }, nil } @@ -72,4 +72,4 @@ func (k *KubeClient) GetNodeTopology(nodeName string) (map[string]string, error) func (k *KubeClient) getNode(nodeName string) (*corev1.Node, error) { return k.clientSet.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) -} \ No newline at end of file +}