[VOL-3285] Resolving statis code analysis warnings
Change-Id: Iaddaae92c649fd27ce0a63f1786af594667c9e8e
diff --git a/internal/bbsimctl/commands/completion.go b/internal/bbsimctl/commands/completion.go
index d7ad19f..27811f3 100644
--- a/internal/bbsimctl/commands/completion.go
+++ b/internal/bbsimctl/commands/completion.go
@@ -17,6 +17,7 @@
import (
"fmt"
+
"github.com/jessevdk/go-flags"
"github.com/opencord/bbsim/internal/bbsimctl/completion"
)
@@ -28,7 +29,7 @@
}
func RegisterCompletionCommands(parent *flags.Parser) {
- parent.AddCommand("completion", "generate shell compleition", "Commands to generate shell completion information", &CompletionOptions{})
+ _, _ = parent.AddCommand("completion", "generate shell compleition", "Commands to generate shell completion information", &CompletionOptions{})
}
func (options *BashOptions) Execute(args []string) error {
diff --git a/internal/bbsimctl/commands/config.go b/internal/bbsimctl/commands/config.go
index b05bb5b..c3d8a14 100644
--- a/internal/bbsimctl/commands/config.go
+++ b/internal/bbsimctl/commands/config.go
@@ -19,6 +19,7 @@
import (
"fmt"
+
"github.com/jessevdk/go-flags"
"github.com/opencord/bbsim/internal/bbsimctl/config"
"gopkg.in/yaml.v2"
@@ -45,7 +46,7 @@
type ConfigOptions struct{}
func RegisterConfigCommands(parent *flags.Parser) {
- parent.AddCommand("config", "generate bbsimctl configuration", "Commands to generate bbsimctl configuration", &ConfigOptions{})
+ _, _ = parent.AddCommand("config", "generate bbsimctl configuration", "Commands to generate bbsimctl configuration", &ConfigOptions{})
}
func (options *ConfigOptions) Execute(args []string) error {
diff --git a/internal/bbsimctl/commands/handler.go b/internal/bbsimctl/commands/handler.go
index 3c4b0ff..6b05534 100644
--- a/internal/bbsimctl/commands/handler.go
+++ b/internal/bbsimctl/commands/handler.go
@@ -16,12 +16,13 @@
package commands
import (
+ "io"
+
"github.com/golang/protobuf/proto"
"github.com/jhump/protoreflect/desc"
"github.com/jhump/protoreflect/dynamic"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
- "io"
)
type RpcEventHandler struct {
@@ -64,7 +65,10 @@
}
for k, v := range fields {
- dmsg.TrySetFieldByName(k, v)
+ err := dmsg.TrySetFieldByName(k, v)
+ if err != nil {
+ return err
+ }
}
delete(h.Fields, dmsg.XXX_MessageName())
diff --git a/internal/bbsimctl/commands/logging.go b/internal/bbsimctl/commands/logging.go
index 42e4771..b9a66b7 100644
--- a/internal/bbsimctl/commands/logging.go
+++ b/internal/bbsimctl/commands/logging.go
@@ -19,6 +19,7 @@
import (
"context"
"fmt"
+
"github.com/jessevdk/go-flags"
pb "github.com/opencord/bbsim/api/bbsim"
"github.com/opencord/bbsim/internal/bbsimctl/config"
@@ -34,7 +35,7 @@
}
func RegisterLoggingCommands(parent *flags.Parser) {
- parent.AddCommand("log", "set bbsim log level", "Commands to set the log level", &LoggingOptions{})
+ _, _ = parent.AddCommand("log", "set bbsim log level", "Commands to set the log level", &LoggingOptions{})
}
func (options *LoggingOptions) Execute(args []string) error {
@@ -59,6 +60,10 @@
logLevel, err := c.SetLogLevel(ctx, &req)
+ if err != nil {
+ log.Fatalf("could not set log level: %v", err)
+ }
+
fmt.Println("New log settings:")
fmt.Println(fmt.Sprintf("\tLevel: %s", logLevel.Level))
fmt.Println(fmt.Sprintf("\tReportCaller: %t", logLevel.Caller))
diff --git a/internal/bbsimctl/commands/olt.go b/internal/bbsimctl/commands/olt.go
index a16edef..5f6747e 100644
--- a/internal/bbsimctl/commands/olt.go
+++ b/internal/bbsimctl/commands/olt.go
@@ -69,7 +69,7 @@
}
func RegisterOltCommands(parser *flags.Parser) {
- parser.AddCommand("olt", "OLT Commands", "Commands to query and manipulate the OLT device", &oltOptions{})
+ _, _ = parser.AddCommand("olt", "OLT Commands", "Commands to query and manipulate the OLT device", &oltOptions{})
}
func getOLT() *pb.Olt {
@@ -103,7 +103,7 @@
// print out
tableFormat := format.Format(DEFAULT_OLT_DEVICE_HEADER_FORMAT)
- tableFormat.Execute(os.Stdout, true, olt)
+ _ = tableFormat.Execute(os.Stdout, true, olt)
return nil
}
@@ -114,7 +114,7 @@
printOltHeader("NNI Ports for", olt)
tableFormat := format.Format(DEFAULT_PORT_HEADER_FORMAT)
- tableFormat.Execute(os.Stdout, true, olt.NNIPorts)
+ _ = tableFormat.Execute(os.Stdout, true, olt.NNIPorts)
return nil
}
@@ -125,7 +125,7 @@
printOltHeader("PON Ports for", olt)
tableFormat := format.Format(DEFAULT_PORT_HEADER_FORMAT)
- tableFormat.Execute(os.Stdout, true, olt.PONPorts)
+ _ = tableFormat.Execute(os.Stdout, true, olt.PONPorts)
return nil
}
diff --git a/internal/bbsimctl/commands/onu.go b/internal/bbsimctl/commands/onu.go
index c331502..771df4c 100644
--- a/internal/bbsimctl/commands/onu.go
+++ b/internal/bbsimctl/commands/onu.go
@@ -109,7 +109,7 @@
}
func RegisterONUCommands(parser *flags.Parser) {
- parser.AddCommand("onu", "ONU Commands", "Commands to query and manipulate ONU devices", &ONUOptions{})
+ _, _ = parser.AddCommand("onu", "ONU Commands", "Commands to query and manipulate ONU devices", &ONUOptions{})
}
func connect() (pb.BBSimClient, *grpc.ClientConn) {
diff --git a/internal/bbsimctl/commands/pon.go b/internal/bbsimctl/commands/pon.go
index 885fb75..332f748 100644
--- a/internal/bbsimctl/commands/pon.go
+++ b/internal/bbsimctl/commands/pon.go
@@ -45,7 +45,7 @@
}
func RegisterPonCommands(parser *flags.Parser) {
- parser.AddCommand("pon", "PON Commands", "Commands to query and manipulate the PON port", &PONOptions{})
+ _, _ = parser.AddCommand("pon", "PON Commands", "Commands to query and manipulate the PON port", &PONOptions{})
}
func (pon *PonPoweronAllOnus) Execute(args []string) error {