Gosec failure fixes and ci checks ajdustment
Change-Id: I430c3118b585ba924649ed32e8196e0e7e0bc260
diff --git a/internal/pkg/ofagent/connection.go b/internal/pkg/ofagent/connection.go
index 6bfd0af..017c00d 100644
--- a/internal/pkg/ofagent/connection.go
+++ b/internal/pkg/ofagent/connection.go
@@ -35,7 +35,10 @@
}
if ofa.volthaConnection != nil {
- ofa.volthaConnection.Close()
+ err := ofa.volthaConnection.Close()
+ if err != nil {
+ logger.Errorw(ctx, "failed-connection-close-proceeding-setting-to-nil", log.Fields{"error": err})
+ }
}
ofa.volthaConnection = nil
diff --git a/internal/pkg/openflow/connection.go b/internal/pkg/openflow/connection.go
index 87a50b3..b9c1c71 100644
--- a/internal/pkg/openflow/connection.go
+++ b/internal/pkg/openflow/connection.go
@@ -72,7 +72,10 @@
if ofc.conn != nil {
logger.Debugw(ctx, "closing-of-connection-to-reconnect",
log.Fields{"device-id": ofc.DeviceID})
- ofc.conn.Close()
+ err := ofc.conn.Close()
+ if err != nil {
+ logger.Errorw(ctx, "failed-connection-close-proceeding-setting-to-nil", log.Fields{"error": err})
+ }
ofc.conn = nil
}
try := 1
@@ -216,7 +219,10 @@
if ofc.conn != nil {
logger.Debugw(ctx, "closing-of-connection",
log.Fields{"device-id": ofc.DeviceID})
- ofc.conn.Close()
+ err := ofc.conn.Close()
+ if err != nil {
+ logger.Errorw(ctx, "closing-of-connection", log.Fields{"error": err})
+ }
ofc.conn = nil
}
logger.Debugw(ctx, "state-machine-finished",
diff --git a/internal/pkg/openflow/stats_test.go b/internal/pkg/openflow/stats_test.go
index cad0352..8c832c2 100644
--- a/internal/pkg/openflow/stats_test.go
+++ b/internal/pkg/openflow/stats_test.go
@@ -124,7 +124,7 @@
flows = append(flows, &flow)
- n = n + 1
+ n++
}
return flows
}
@@ -154,7 +154,7 @@
ports = append(ports, &port)
- n = n + 1
+ n++
}
return ports
}
@@ -229,7 +229,7 @@
t.Fatal("Message size is bigger than 64KB")
}
- entriesCount = entriesCount + len(r.GetEntries())
+ entriesCount += len(r.GetEntries())
n++
}
// make sure all the generate item are included in the responses
@@ -276,7 +276,7 @@
t.Fatal("Message size is bigger than 64KB")
}
- entriesCount = entriesCount + len(r.GetEntries())
+ entriesCount += len(r.GetEntries())
n++
}
@@ -322,7 +322,7 @@
t.Fatal("Message size is bigger than 64KB")
}
- entriesCount = entriesCount + len(r.GetEntries())
+ entriesCount += len(r.GetEntries())
n++
}