Skip to content

Commit 30b6cf3

Browse files
committed
various linter corrections and code cleanup
Signed-off-by: Humble Chirammal <[email protected]>
1 parent ad94dad commit 30b6cf3

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

iscsi/iscsi.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type iscsiSession struct {
4141

4242
type deviceInfo []Device
4343

44-
// Device contains informations about a device
44+
// Device contains information about a device
4545
type Device struct {
4646
Name string `json:"name"`
4747
Hctl string `json:"hctl"`
@@ -58,28 +58,26 @@ type HCTL struct {
5858
LUN int
5959
}
6060

61-
// Connector provides a struct to hold all of the needed parameters to make our iSCSI connection
61+
// Connector provides a struct to hold all the needed parameters to make our iSCSI connection
6262
type Connector struct {
63-
VolumeName string `json:"volume_name"`
64-
TargetIqn string `json:"target_iqn"`
65-
TargetPortals []string `json:"target_portal"`
66-
Lun int32 `json:"lun"`
67-
AuthType string `json:"auth_type"`
68-
DiscoverySecrets Secrets `json:"discovery_secrets"`
69-
SessionSecrets Secrets `json:"session_secrets"`
70-
Interface string `json:"interface"`
71-
63+
VolumeName string `json:"volume_name"`
64+
TargetIqn string `json:"target_iqn"`
65+
TargetPortals []string `json:"target_portal"`
66+
Lun int32 `json:"lun"`
67+
AuthType string `json:"auth_type"`
68+
DiscoverySecrets Secrets `json:"discovery_secrets"`
69+
SessionSecrets Secrets `json:"session_secrets"`
70+
Interface string `json:"interface"`
7271
MountTargetDevice *Device `json:"mount_target_device"`
7372
Devices []Device `json:"devices"`
74-
75-
RetryCount uint `json:"retry_count"`
76-
CheckInterval uint `json:"check_interval"`
77-
DoDiscovery bool `json:"do_discovery"`
78-
DoCHAPDiscovery bool `json:"do_chap_discovery"`
73+
RetryCount uint `json:"retry_count"`
74+
CheckInterval uint `json:"check_interval"`
75+
DoDiscovery bool `json:"do_discovery"`
76+
DoCHAPDiscovery bool `json:"do_chap_discovery"`
7977
}
8078

8179
func init() {
82-
// by default we don't log anything, EnableDebugLogging() can turn on some tracing
80+
// by default, we don't log anything, EnableDebugLogging() can turn on some tracing
8381
debug = log.New(ioutil.Discard, "", 0)
8482
}
8583

@@ -89,7 +87,7 @@ func EnableDebugLogging(writer io.Writer) {
8987
debug = log.New(writer, "DEBUG: ", log.Ldate|log.Ltime|log.Lshortfile)
9088
}
9189

92-
// parseSession takes the raw stdout from the iscsiadm -m session command and encodes it into an iSCSI session type
90+
// parseSession takes the raw stdout from the `iscsiadm -m session` command and encodes it into an iSCSI session type
9391
func parseSessions(lines string) []iscsiSession {
9492
entries := strings.Split(strings.TrimSpace(lines), "\n")
9593
r := strings.NewReplacer("[", "",
@@ -115,6 +113,7 @@ func parseSessions(lines string) []iscsiSession {
115113
}
116114
sessions = append(sessions, s)
117115
}
116+
118117
return sessions
119118
}
120119

@@ -322,7 +321,7 @@ func (c *Connector) connectTarget(targetIqn string, target string, iFace string,
322321
if _, err := iscsiCmd(append(baseArgs, []string{"-R"}...)...); err != nil {
323322
debug.Printf("Failed to rescan session, err: %v", err)
324323
if os.IsTimeout(err) {
325-
debug.Printf("iscsiadm timeouted, logging out")
324+
debug.Printf("iscsiadm timeout, logging out")
326325
cmd := execCommand("iscsiadm", append(baseArgs, []string{"-u"}...)...)
327326
out, err := cmd.CombinedOutput()
328327
if err != nil {
@@ -404,7 +403,7 @@ func Disconnect(targetIqn string, targets []string) {
404403
}
405404

406405
// Disconnect performs a disconnect operation from an appliance.
407-
// Be sure to disconnect all deivces properly before doing this as it can result in data loss.
406+
// Be sure to disconnect all devices properly before doing this as it can result in data loss.
408407
func (c *Connector) Disconnect() {
409408
Disconnect(c.TargetIqn, c.TargetPortals)
410409
}
@@ -795,7 +794,7 @@ func (d *Device) Delete() error {
795794
return d.WriteDeviceFile("delete", "1")
796795
}
797796

798-
// Rescan rescan an SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/rescan
797+
// Rescan does a rescan of SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/rescan
799798
func (d *Device) Rescan() error {
800799
return d.WriteDeviceFile("rescan", "1")
801800
}

0 commit comments

Comments
 (0)