VOL-1900 lint warning fixes
Change-Id: Ibbe15bc887f0ed9e0de4d01b522f0a0429773b44
diff --git a/cli/menu/devicemenu/deviceMenu.go b/cli/menu/devicemenu/deviceMenu.go
index 134c46d..a392e95 100644
--- a/cli/menu/devicemenu/deviceMenu.go
+++ b/cli/menu/devicemenu/deviceMenu.go
@@ -29,7 +29,7 @@
*/
var (
Conn *grpc.ClientConn
- DeviceId *string
+ DeviceID *string
InputPrompt *string
Commands *[]string
)
@@ -37,10 +37,10 @@
/*
MainLoop - the loop which processes commands at the main level
*/
-func MainLoop(conn *grpc.ClientConn, deviceId string) {
+func MainLoop(conn *grpc.ClientConn, deviceID string) {
- DeviceId = &deviceId
- inputPrompt := fmt.Sprint("(" + color.LightRed("device "+deviceId) + ") ")
+ DeviceID = &deviceID
+ inputPrompt := fmt.Sprint("(" + color.LightRed("device "+deviceID) + ") ")
InputPrompt = &inputPrompt
funcTable := make(map[string]func(bool))
// inputPromptSize := len(inputPrompt)
@@ -52,7 +52,7 @@
funcTable["img_dnld_request"] = doImgDnldRequest
funcTable["perf_config"] = doPerfConfig
funcTable["save"] = doSave
- funcTable["eof"] = doEof
+ funcTable["eof"] = doEOF
funcTable["images"] = doImages
funcTable["img_dnld_status"] = doImgDnldStatus
funcTable["ports"] = doPorts
@@ -73,7 +73,7 @@
commands := make([]string, len(funcTable))
i := 0
- for key, _ := range funcTable {
+ for key := range funcTable {
commands[i] = key
i++
}
diff --git a/cli/menu/devicemenu/eof.go b/cli/menu/devicemenu/eof.go
index e4309bf..2c73b26 100644
--- a/cli/menu/devicemenu/eof.go
+++ b/cli/menu/devicemenu/eof.go
@@ -18,6 +18,6 @@
import "fmt"
-func doEof(enterPressed bool) {
- fmt.Println("doEof")
+func doEOF(enterPressed bool) {
+ fmt.Println("doEOF")
}
diff --git a/cli/menu/devicemenu/help.go b/cli/menu/devicemenu/help.go
index 6ebe8d9..8df6a20 100644
--- a/cli/menu/devicemenu/help.go
+++ b/cli/menu/devicemenu/help.go
@@ -22,6 +22,7 @@
"strings"
"github.com/opencord/voltha-go/cli/util"
+ "github.com/opencord/voltha-lib-go/v2/pkg/log"
)
func doHelp(enterPressed bool) {
@@ -29,7 +30,10 @@
var b = make([]byte, 1)
inputPrompt := *InputPrompt + "help "
for {
- os.Stdin.Read(b)
+ _, err := os.Stdin.Read(b)
+ if err != nil {
+ log.Errorw("unable-to-read-from-stdin-file", log.Fields{"error": err})
+ }
char := string(b)
if char == "\t" || char == "\n" || char == "?" {
if enterPressed {
diff --git a/cli/menu/devicemenu/show.go b/cli/menu/devicemenu/show.go
index c1680a8..fc56eed 100644
--- a/cli/menu/devicemenu/show.go
+++ b/cli/menu/devicemenu/show.go
@@ -28,8 +28,8 @@
func doShow(enterPressed bool) {
client := voltha.NewVolthaServiceClient(Conn)
- fmt.Println(*DeviceId)
- device, err := client.GetDevice(context.Background(), &common.ID{Id: *DeviceId})
+ fmt.Println(*DeviceID)
+ device, err := client.GetDevice(context.Background(), &common.ID{Id: *DeviceID})
if err != nil {
fmt.Println(err)
}
@@ -46,10 +46,10 @@
Type["value"] = device.Type
rows = append(rows, Type)
- parentId := make(map[string]string)
- parentId["field"] = "parent_id"
- parentId["value"] = device.ParentId
- rows = append(rows, parentId)
+ parentID := make(map[string]string)
+ parentID["field"] = "parent_id"
+ parentID["value"] = device.ParentId
+ rows = append(rows, parentID)
vlan := make(map[string]string)
vlan["field"] = "vlan"
@@ -62,20 +62,20 @@
rows = append(rows, adminState)
proxyAddress := device.GetProxyAddress()
- proxyDeviceId := make(map[string]string)
- proxyDeviceId["field"] = "proxy_address.device_id"
- proxyDeviceId["value"] = proxyAddress.DeviceId
- rows = append(rows, proxyDeviceId)
+ proxyDeviceID := make(map[string]string)
+ proxyDeviceID["field"] = "proxy_address.device_id"
+ proxyDeviceID["value"] = proxyAddress.DeviceId
+ rows = append(rows, proxyDeviceID)
proxyDeviceType := make(map[string]string)
proxyDeviceType["field"] = "proxy_address.device_type"
proxyDeviceType["value"] = proxyAddress.DeviceType
rows = append(rows, proxyDeviceType)
- proxyChannelId := make(map[string]string)
- proxyChannelId["field"] = "proxy_address.channel_id"
- proxyChannelId["value"] = strconv.FormatUint(uint64(proxyAddress.ChannelId), 10)
- rows = append(rows, proxyChannelId)
+ proxyChannelID := make(map[string]string)
+ proxyChannelID["field"] = "proxy_address.channel_id"
+ proxyChannelID["value"] = strconv.FormatUint(uint64(proxyAddress.ChannelId), 10)
+ rows = append(rows, proxyChannelID)
parentPortNumber := make(map[string]string)
parentPortNumber["field"] = "parent_port_no"