fix golint problem of volume cephfs/iscsi/nfs

This commit is contained in:
jianglingxia
2018-11-17 12:50:47 +08:00
parent d50e920906
commit 0094e05975
4 changed files with 55 additions and 56 deletions

View File

@@ -54,12 +54,12 @@ const (
)
var (
chap_st = []string{
chapSt = []string{
"discovery.sendtargets.auth.username",
"discovery.sendtargets.auth.password",
"discovery.sendtargets.auth.username_in",
"discovery.sendtargets.auth.password_in"}
chap_sess = []string{
chapSess = []string{
"node.session.auth.username",
"node.session.auth.password",
"node.session.auth.username_in",
@@ -69,7 +69,7 @@ var (
)
func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error {
if !b.chap_discovery {
if !b.chapDiscovery {
return nil
}
out, err := b.exec.Run("iscsiadm", "-m", "discoverydb", "-t", "sendtargets", "-p", tp, "-I", b.Iface, "-o", "update", "-n", "discovery.sendtargets.auth.authmethod", "-v", "CHAP")
@@ -77,7 +77,7 @@ func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error {
return fmt.Errorf("iscsi: failed to update discoverydb with CHAP, output: %v", string(out))
}
for _, k := range chap_st {
for _, k := range chapSt {
v := b.secret[k]
if len(v) > 0 {
out, err := b.exec.Run("iscsiadm", "-m", "discoverydb", "-t", "sendtargets", "-p", tp, "-I", b.Iface, "-o", "update", "-n", k, "-v", v)
@@ -90,7 +90,7 @@ func updateISCSIDiscoverydb(b iscsiDiskMounter, tp string) error {
}
func updateISCSINode(b iscsiDiskMounter, tp string) error {
if !b.chap_session {
if !b.chapSession {
return nil
}
@@ -99,7 +99,7 @@ func updateISCSINode(b iscsiDiskMounter, tp string) error {
return fmt.Errorf("iscsi: failed to update node with CHAP, output: %v", string(out))
}
for _, k := range chap_sess {
for _, k := range chapSess {
v := b.secret[k]
if len(v) > 0 {
out, err := b.exec.Run("iscsiadm", "-m", "node", "-p", tp, "-T", b.Iqn, "-I", b.Iface, "-o", "update", "-n", k, "-v", v)
@@ -210,7 +210,7 @@ func (util *ISCSIUtil) persistISCSI(conf iscsiDisk, mnt string) error {
defer fp.Close()
encoder := json.NewEncoder(fp)
if err = encoder.Encode(conf); err != nil {
return fmt.Errorf("iscsi: encode err: %v.", err)
return fmt.Errorf("iscsi: encode err: %v", err)
}
return nil
}
@@ -224,7 +224,7 @@ func (util *ISCSIUtil) loadISCSI(conf *iscsiDisk, mnt string) error {
defer fp.Close()
decoder := json.NewDecoder(fp)
if err = decoder.Decode(conf); err != nil {
return fmt.Errorf("iscsi: decode err: %v.", err)
return fmt.Errorf("iscsi: decode err: %v", err)
}
return nil
}