[VOL-3285] Resolving statis code analysis warnings

Change-Id: Iaddaae92c649fd27ce0a63f1786af594667c9e8e
diff --git a/internal/bbsim/devices/helpers_test.go b/internal/bbsim/devices/helpers_test.go
index 818009f..2d23a70 100644
--- a/internal/bbsim/devices/helpers_test.go
+++ b/internal/bbsim/devices/helpers_test.go
@@ -17,9 +17,10 @@
 package devices
 
 import (
+	"testing"
+
 	"github.com/looplab/fsm"
 	"gotest.tools/assert"
-	"testing"
 )
 
 var (
@@ -60,7 +61,6 @@
 	cb_called := 0
 	cb := func(e *fsm.Event) {
 		cb_called++
-		return
 	}
 
 	// calling the method under test
@@ -79,7 +79,7 @@
 	assert.Equal(t, args.events[1].Dst, "down")
 
 	// this is to test that the callback is called when the state change
-	sm.Event("enable")
+	_ = sm.Event("enable")
 	assert.Equal(t, cb_called, 1)
 
 	tearDownHelpers()
diff --git a/internal/bbsim/devices/messageTypes.go b/internal/bbsim/devices/messageTypes.go
index 5652520..f59ea5c 100644
--- a/internal/bbsim/devices/messageTypes.go
+++ b/internal/bbsim/devices/messageTypes.go
@@ -140,7 +140,7 @@
 
 const (
 	UP   OperState = iota
-	DOWN  // The device has been discovered, but not yet activated
+	DOWN           // The device has been discovered, but not yet activated
 )
 
 func (m OperState) String() string {
diff --git a/internal/bbsim/devices/nni.go b/internal/bbsim/devices/nni.go
index fabe69c..e74e97b 100644
--- a/internal/bbsim/devices/nni.go
+++ b/internal/bbsim/devices/nni.go
@@ -71,7 +71,7 @@
 		}),
 		Type: "nni",
 	}
-	createNNIPair(executor, olt, &nniPort)
+	_ = createNNIPair(executor, olt, &nniPort)
 	return nniPort, nil
 }
 
@@ -81,7 +81,7 @@
 	isDhcp := packetHandlers.IsDhcpPacket(packet)
 	isLldp := packetHandlers.IsLldpPacket(packet)
 
-	if isDhcp == false && isLldp == false {
+	if !isDhcp && !isLldp {
 		nniLogger.WithFields(log.Fields{
 			"packet": packet,
 		}).Trace("Dropping NNI packet as it's not DHCP")
@@ -145,14 +145,6 @@
 	return nil
 }
 
-func deleteNNIPair(executor Executor, nniPort *NniPort) error {
-	if err := executor.Command("ip", "link", "del", nniPort.nniVeth).Run(); err != nil {
-		nniLogger.Errorf("Couldn't delete veth pair between %s and %s", nniPort.nniVeth, nniPort.upstreamVeth)
-		return err
-	}
-	return nil
-}
-
 // NewVethChan returns a new channel for receiving packets over the NNI interface
 func (n *NniPort) NewVethChan() (chan *types.PacketMsg, *pcap.Handle, error) {
 	ch, handle, err := listenOnVeth(n.nniVeth)
diff --git a/internal/bbsim/devices/olt.go b/internal/bbsim/devices/olt.go
index e0d1556..21b57f2 100644
--- a/internal/bbsim/devices/olt.go
+++ b/internal/bbsim/devices/olt.go
@@ -18,7 +18,6 @@
 
 import (
 	"context"
-	"errors"
 	"fmt"
 	"net"
 	"sync"
@@ -137,7 +136,7 @@
 		},
 	)
 
-	if isMock != true {
+	if !isMock {
 		// create NNI Port
 		nniPort, err := CreateNNI(&olt)
 		if err != nil {
@@ -187,7 +186,7 @@
 		}
 	}
 
-	if isMock != true {
+	if !isMock {
 		if err := olt.InternalState.Event("initialize"); err != nil {
 			log.Errorf("Error initializing OLT: %v", err)
 			return nil
@@ -203,7 +202,7 @@
 	return &olt
 }
 
-func (o *OltDevice) InitOlt() error {
+func (o *OltDevice) InitOlt() {
 
 	if oltServer == nil {
 		oltServer, _ = o.newOltServer()
@@ -235,8 +234,6 @@
 			oltLogger.Errorf("Error getting NNI channel: %v", err)
 		}
 	}
-
-	return nil
 }
 
 func (o *OltDevice) RestartOLT() error {
@@ -274,7 +271,7 @@
 
 		for _, onu := range pon.Onus {
 			if onu.InternalState.Current() != "initialized" {
-				onu.InternalState.Event("disable")
+				_ = onu.InternalState.Event("disable")
 			}
 		}
 	}
@@ -312,7 +309,7 @@
 
 	reflection.Register(grpcServer)
 
-	go grpcServer.Serve(lis)
+	go func() { _ = grpcServer.Serve(lis) }()
 	oltLogger.Debugf("OLT listening on %v", address)
 
 	return grpcServer, nil
@@ -335,7 +332,7 @@
 // Device Methods
 
 // Enable implements the OpenOLT EnableIndicationServer functionality
-func (o *OltDevice) Enable(stream openolt.Openolt_EnableIndicationServer) error {
+func (o *OltDevice) Enable(stream openolt.Openolt_EnableIndicationServer) {
 	oltLogger.Debug("Enable OLT called")
 	rebootFlag := false
 
@@ -383,7 +380,7 @@
 
 	go o.processOmciMessages(o.enableContext, stream, &wg)
 
-	if rebootFlag == true {
+	if rebootFlag {
 		for _, pon := range o.Pons {
 			if pon.InternalState.Current() == "disabled" {
 				msg := Message{
@@ -424,7 +421,6 @@
 	}
 
 	wg.Wait()
-	return nil
 }
 
 func (o *OltDevice) processOmciMessages(ctx context.Context, stream openolt.Openolt_EnableIndicationServer, wg *sync.WaitGroup) {
@@ -499,22 +495,22 @@
 
 // Helpers method
 
-func (o OltDevice) GetPonById(id uint32) (*PonPort, error) {
+func (o *OltDevice) GetPonById(id uint32) (*PonPort, error) {
 	for _, pon := range o.Pons {
 		if pon.ID == id {
 			return pon, nil
 		}
 	}
-	return nil, errors.New(fmt.Sprintf("Cannot find PonPort with id %d in OLT %d", id, o.ID))
+	return nil, fmt.Errorf("Cannot find PonPort with id %d in OLT %d", id, o.ID)
 }
 
-func (o OltDevice) getNniById(id uint32) (*NniPort, error) {
+func (o *OltDevice) getNniById(id uint32) (*NniPort, error) {
 	for _, nni := range o.Nnis {
 		if nni.ID == id {
 			return nni, nil
 		}
 	}
-	return nil, errors.New(fmt.Sprintf("Cannot find NniPort with id %d in OLT %d", id, o.ID))
+	return nil, fmt.Errorf("Cannot find NniPort with id %d in OLT %d", id, o.ID)
 }
 
 func (o *OltDevice) sendAlarmIndication(alarmInd *openolt.AlarmIndication, stream openolt.Openolt_EnableIndicationServer) {
@@ -662,11 +658,11 @@
 			case OltIndication:
 				msg, _ := message.Data.(OltIndicationMessage)
 				if msg.OperState == UP {
-					o.InternalState.Event("enable")
-					o.OperState.Event("enable")
+					_ = o.InternalState.Event("enable")
+					_ = o.OperState.Event("enable")
 				} else if msg.OperState == DOWN {
-					o.InternalState.Event("disable")
-					o.OperState.Event("disable")
+					_ = o.InternalState.Event("disable")
+					_ = o.OperState.Event("disable")
 				}
 				o.sendOltIndication(msg, stream)
 			case AlarmIndication:
@@ -789,7 +785,7 @@
 }
 
 // returns an ONU with a given Serial Number
-func (o OltDevice) FindOnuBySn(serialNumber string) (*Onu, error) {
+func (o *OltDevice) FindOnuBySn(serialNumber string) (*Onu, error) {
 	// TODO this function can be a performance bottleneck when we have many ONUs,
 	// memoizing it will remove the bottleneck
 	for _, pon := range o.Pons {
@@ -800,11 +796,11 @@
 		}
 	}
 
-	return &Onu{}, errors.New(fmt.Sprintf("cannot-find-onu-by-serial-number-%s", serialNumber))
+	return &Onu{}, fmt.Errorf("cannot-find-onu-by-serial-number-%s", serialNumber)
 }
 
 // returns an ONU with a given interface/Onu Id
-func (o OltDevice) FindOnuById(intfId uint32, onuId uint32) (*Onu, error) {
+func (o *OltDevice) FindOnuById(intfId uint32, onuId uint32) (*Onu, error) {
 	// TODO this function can be a performance bottleneck when we have many ONUs,
 	// memoizing it will remove the bottleneck
 	for _, pon := range o.Pons {
@@ -816,11 +812,11 @@
 			}
 		}
 	}
-	return &Onu{}, errors.New(fmt.Sprintf("cannot-find-onu-by-id-%v-%v", intfId, onuId))
+	return &Onu{}, fmt.Errorf("cannot-find-onu-by-id-%v-%v", intfId, onuId)
 }
 
 // returns an ONU with a given Mac Address
-func (o OltDevice) FindOnuByMacAddress(mac net.HardwareAddr) (*Onu, error) {
+func (o *OltDevice) FindOnuByMacAddress(mac net.HardwareAddr) (*Onu, error) {
 	// TODO this function can be a performance bottleneck when we have many ONUs,
 	// memoizing it will remove the bottleneck
 	for _, pon := range o.Pons {
@@ -831,12 +827,12 @@
 		}
 	}
 
-	return &Onu{}, errors.New(fmt.Sprintf("cannot-find-onu-by-mac-address-%s", mac))
+	return &Onu{}, fmt.Errorf("cannot-find-onu-by-mac-address-%s", mac)
 }
 
 // GRPC Endpoints
 
-func (o OltDevice) ActivateOnu(context context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
+func (o *OltDevice) ActivateOnu(context context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"OnuSn": onuSnToString(onu.SerialNumber),
 	}).Info("Received ActivateOnu call from VOLTHA")
@@ -866,12 +862,12 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) DeactivateOnu(context.Context, *openolt.Onu) (*openolt.Empty, error) {
+func (o *OltDevice) DeactivateOnu(context.Context, *openolt.Onu) (*openolt.Empty, error) {
 	oltLogger.Error("DeactivateOnu not implemented")
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) DeleteOnu(_ context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
+func (o *OltDevice) DeleteOnu(_ context.Context, onu *openolt.Onu) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"IntfId": onu.IntfId,
 		"OnuId":  onu.OnuId,
@@ -910,7 +906,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) DisableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
+func (o *OltDevice) DisableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
 	// NOTE when we disable the OLT should we disable NNI, PONs and ONUs altogether?
 	oltLogger.WithFields(log.Fields{
 		"oltId": o.ID,
@@ -945,7 +941,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) DisablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
+func (o *OltDevice) DisablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
 	oltLogger.Infof("DisablePonIf request received for PON %d", intf.IntfId)
 	ponID := intf.GetIntfId()
 	pon, _ := o.GetPonById(intf.IntfId)
@@ -981,7 +977,7 @@
 	return nil
 }
 
-func (o OltDevice) EnablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
+func (o *OltDevice) EnablePonIf(_ context.Context, intf *openolt.Interface) (*openolt.Empty, error) {
 	oltLogger.Infof("EnablePonIf request received for PON %d", intf.IntfId)
 	ponID := intf.GetIntfId()
 	pon, _ := o.GetPonById(intf.IntfId)
@@ -1010,7 +1006,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) FlowAdd(ctx context.Context, flow *openolt.Flow) (*openolt.Empty, error) {
+func (o *OltDevice) FlowAdd(ctx context.Context, flow *openolt.Flow) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"IntfId":    flow.AccessIntfId,
 		"OnuId":     flow.OnuId,
@@ -1078,7 +1074,7 @@
 }
 
 // FlowRemove request from VOLTHA
-func (o OltDevice) FlowRemove(_ context.Context, flow *openolt.Flow) (*openolt.Empty, error) {
+func (o *OltDevice) FlowRemove(_ context.Context, flow *openolt.Flow) (*openolt.Empty, error) {
 
 	oltLogger.WithFields(log.Fields{
 		"FlowId":   flow.FlowId,
@@ -1150,7 +1146,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) HeartbeatCheck(context.Context, *openolt.Empty) (*openolt.Heartbeat, error) {
+func (o *OltDevice) HeartbeatCheck(context.Context, *openolt.Empty) (*openolt.Heartbeat, error) {
 	res := openolt.Heartbeat{HeartbeatSignature: uint32(time.Now().Unix())}
 	oltLogger.WithFields(log.Fields{
 		"signature": res.HeartbeatSignature,
@@ -1168,10 +1164,10 @@
 			}
 		}
 	}
-	return nil, errors.New(fmt.Sprintf("Cannot find Onu by flowId %d", flowId))
+	return nil, fmt.Errorf("Cannot find Onu by flowId %d", flowId)
 }
 
-func (o OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error) {
+func (o *OltDevice) GetDeviceInfo(context.Context, *openolt.Empty) (*openolt.DeviceInfo, error) {
 
 	oltLogger.WithFields(log.Fields{
 		"oltId":    o.ID,
@@ -1198,7 +1194,7 @@
 	return devinfo, nil
 }
 
-func (o OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error) {
+func (o *OltDevice) OmciMsgOut(ctx context.Context, omci_msg *openolt.OmciMsg) (*openolt.Empty, error) {
 	pon, err := o.GetPonById(omci_msg.IntfId)
 	if err != nil {
 		oltLogger.WithFields(log.Fields{
@@ -1236,7 +1232,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) OnuPacketOut(ctx context.Context, onuPkt *openolt.OnuPacket) (*openolt.Empty, error) {
+func (o *OltDevice) OnuPacketOut(ctx context.Context, onuPkt *openolt.OnuPacket) (*openolt.Empty, error) {
 	pon, err := o.GetPonById(onuPkt.IntfId)
 	if err != nil {
 		oltLogger.WithFields(log.Fields{
@@ -1261,7 +1257,7 @@
 	}).Tracef("Received OnuPacketOut")
 
 	rawpkt := gopacket.NewPacket(onuPkt.Pkt, layers.LayerTypeEthernet, gopacket.Default)
-	pktType, err := packetHandlers.IsEapolOrDhcp(rawpkt)
+	pktType, _ := packetHandlers.IsEapolOrDhcp(rawpkt)
 
 	msg := Message{
 		Type: OnuPacketOut,
@@ -1277,16 +1273,16 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) Reboot(context.Context, *openolt.Empty) (*openolt.Empty, error) {
+func (o *OltDevice) Reboot(context.Context, *openolt.Empty) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"oltId": o.ID,
 	}).Info("Shutting down")
 	publishEvent("OLT-reboot-received", -1, -1, "")
-	go o.RestartOLT()
+	go func() { _ = o.RestartOLT() }()
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) ReenableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
+func (o *OltDevice) ReenableOlt(context.Context, *openolt.Empty) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"oltId": o.ID,
 	}).Info("Received ReenableOlt request from VOLTHA")
@@ -1317,40 +1313,40 @@
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) UplinkPacketOut(context context.Context, packet *openolt.UplinkPacket) (*openolt.Empty, error) {
+func (o *OltDevice) UplinkPacketOut(context context.Context, packet *openolt.UplinkPacket) (*openolt.Empty, error) {
 	pkt := gopacket.NewPacket(packet.Pkt, layers.LayerTypeEthernet, gopacket.Default)
 
-	o.Nnis[0].sendNniPacket(pkt) // FIXME we are assuming we have only one NNI
+	_ = o.Nnis[0].sendNniPacket(pkt) // FIXME we are assuming we have only one NNI
 	// NOTE should we return an error if sendNniPakcet fails?
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) CollectStatistics(context.Context, *openolt.Empty) (*openolt.Empty, error) {
+func (o *OltDevice) CollectStatistics(context.Context, *openolt.Empty) (*openolt.Empty, error) {
 	oltLogger.Error("CollectStatistics not implemented")
 	return new(openolt.Empty), nil
 }
 
-func (o OltDevice) GetOnuInfo(context context.Context, packet *openolt.Onu) (*openolt.OnuIndication, error) {
+func (o *OltDevice) GetOnuInfo(context context.Context, packet *openolt.Onu) (*openolt.OnuIndication, error) {
 	oltLogger.Error("GetOnuInfo not implemented")
 	return new(openolt.OnuIndication), nil
 }
 
-func (o OltDevice) GetPonIf(context context.Context, packet *openolt.Interface) (*openolt.IntfIndication, error) {
+func (o *OltDevice) GetPonIf(context context.Context, packet *openolt.Interface) (*openolt.IntfIndication, error) {
 	oltLogger.Error("GetPonIf not implemented")
 	return new(openolt.IntfIndication), nil
 }
 
-func (s OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
+func (s *OltDevice) CreateTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
 	oltLogger.Info("received CreateTrafficQueues")
 	return new(openolt.Empty), nil
 }
 
-func (s OltDevice) RemoveTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
+func (s *OltDevice) RemoveTrafficQueues(context.Context, *tech_profile.TrafficQueues) (*openolt.Empty, error) {
 	oltLogger.Info("received RemoveTrafficQueues")
 	return new(openolt.Empty), nil
 }
 
-func (s OltDevice) CreateTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
+func (s *OltDevice) CreateTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"OnuId":     trafficSchedulers.OnuId,
 		"IntfId":    trafficSchedulers.IntfId,
@@ -1373,7 +1369,7 @@
 	return new(openolt.Empty), nil
 }
 
-func (s OltDevice) RemoveTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
+func (s *OltDevice) RemoveTrafficSchedulers(context context.Context, trafficSchedulers *tech_profile.TrafficSchedulers) (*openolt.Empty, error) {
 	oltLogger.WithFields(log.Fields{
 		"OnuId":     trafficSchedulers.OnuId,
 		"IntfId":    trafficSchedulers.IntfId,
@@ -1397,7 +1393,7 @@
 }
 
 // assumes caller has properly formulated an openolt.AlarmIndication
-func (o OltDevice) SendAlarmIndication(context context.Context, ind *openolt.AlarmIndication) error {
+func (o *OltDevice) SendAlarmIndication(context context.Context, ind *openolt.AlarmIndication) error {
 	msg := Message{
 		Type: AlarmIndication,
 		Data: ind,
@@ -1406,21 +1402,3 @@
 	o.channel <- msg
 	return nil
 }
-
-func getOltIP() net.IP {
-	conn, err := net.Dial("udp", "8.8.8.8:80")
-	if err != nil {
-		oltLogger.Error(err.Error())
-		return net.IP{}
-	}
-	defer func() {
-		err := conn.Close()
-		if err != nil {
-			oltLogger.Error(err.Error())
-		}
-	}()
-
-	localAddr := conn.LocalAddr().(*net.UDPAddr)
-
-	return localAddr.IP
-}
diff --git a/internal/bbsim/devices/olt_test.go b/internal/bbsim/devices/olt_test.go
index 747ddf8..8aa0ae6 100644
--- a/internal/bbsim/devices/olt_test.go
+++ b/internal/bbsim/devices/olt_test.go
@@ -17,14 +17,15 @@
 package devices
 
 import (
-	"github.com/opencord/voltha-protos/v2/go/openolt"
-	"gotest.tools/assert"
 	"net"
 	"testing"
+
+	"github.com/opencord/voltha-protos/v2/go/openolt"
+	"gotest.tools/assert"
 )
 
-func createMockOlt(numPon int, numOnu int) OltDevice {
-	olt := OltDevice{
+func createMockOlt(numPon int, numOnu int) *OltDevice {
+	olt := &OltDevice{
 		ID: 0,
 	}
 
@@ -116,7 +117,7 @@
 	// Add the flows to onus (to be found)
 	onu1, _ := olt.FindOnuBySn("BBSM00000303")
 	flow1 := openolt.Flow{
-		FlowId: 64,
+		FlowId:     64,
 		Classifier: &openolt.Classifier{},
 	}
 	msg1 := OnuFlowUpdateMessage{
@@ -128,7 +129,7 @@
 
 	onu2, _ := olt.FindOnuBySn("BBSM00000103")
 	flow2 := openolt.Flow{
-		FlowId: 72,
+		FlowId:     72,
 		Classifier: &openolt.Classifier{},
 	}
 	msg2 := OnuFlowUpdateMessage{
@@ -138,10 +139,8 @@
 	}
 	onu2.handleFlowAdd(msg2)
 
-
-
 	found, err := olt.GetOnuByFlowId(flow1.FlowId)
 
 	assert.Equal(t, err, nil)
 	assert.Equal(t, found.Sn(), onu1.Sn())
-}
\ No newline at end of file
+}
diff --git a/internal/bbsim/devices/onu.go b/internal/bbsim/devices/onu.go
index beb3779..6c53b68 100644
--- a/internal/bbsim/devices/onu.go
+++ b/internal/bbsim/devices/onu.go
@@ -253,11 +253,11 @@
 				}
 			},
 			"before_start_auth": func(e *fsm.Event) {
-				if o.EapolFlowReceived == false {
+				if !o.EapolFlowReceived {
 					e.Cancel(errors.New("cannot-go-to-auth-started-as-eapol-flow-is-missing"))
 					return
 				}
-				if o.GemPortAdded == false {
+				if !o.GemPortAdded {
 					e.Cancel(errors.New("cannot-go-to-auth-started-as-gemport-is-missing"))
 					return
 				}
@@ -291,12 +291,12 @@
 					return
 				}
 
-				if o.DhcpFlowReceived == false {
+				if !o.DhcpFlowReceived {
 					e.Cancel(errors.New("cannot-go-to-dhcp-started-as-dhcp-flow-is-missing"))
 					return
 				}
 
-				if o.GemPortAdded == false {
+				if !o.GemPortAdded {
 					e.Cancel(errors.New("cannot-go-to-dhcp-started-as-gemport-is-missing"))
 					return
 				}
@@ -432,7 +432,7 @@
 				} else if msg.Type == packetHandlers.DHCP {
 					// NOTE here we receive packets going from the DHCP Server to the ONU
 					// for now we expect them to be double-tagged, but ideally the should be single tagged
-					dhcp.HandleNextPacket(o.PonPort.Olt.ID, o.ID, o.PonPortID, o.Sn(), o.PortNo, o.HwAddress, o.CTag, o.InternalState, msg.Packet, stream)
+					_ = dhcp.HandleNextPacket(o.PonPort.Olt.ID, o.ID, o.PonPortID, o.Sn(), o.PortNo, o.HwAddress, o.CTag, o.InternalState, msg.Packet, stream)
 				}
 			case OnuPacketIn:
 				// NOTE we only receive BBR packets here.
@@ -449,7 +449,7 @@
 				if msg.Type == packetHandlers.EAPOL {
 					eapol.HandleNextPacket(msg.OnuId, msg.IntfId, o.Sn(), o.PortNo, o.InternalState, msg.Packet, stream, client)
 				} else if msg.Type == packetHandlers.DHCP {
-					dhcp.HandleNextBbrPacket(o.ID, o.PonPortID, o.Sn(), o.STag, o.HwAddress, o.DoneChannel, msg.Packet, client)
+					_ = dhcp.HandleNextBbrPacket(o.ID, o.PonPortID, o.Sn(), o.STag, o.HwAddress, o.DoneChannel, msg.Packet, client)
 				}
 			case OmciIndication:
 				msg, _ := message.Data.(OmciIndicationMessage)
@@ -460,13 +460,13 @@
 				o.sendDhcpFlow(client)
 			case IGMPMembershipReportV2:
 				log.Infof("Recieved IGMPMembershipReportV2 message on ONU channel")
-				igmp.SendIGMPMembershipReportV2(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
+				_ = igmp.SendIGMPMembershipReportV2(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
 			case IGMPLeaveGroup:
 				log.Infof("Recieved IGMPLeaveGroupV2 message on ONU channel")
-				igmp.SendIGMPLeaveGroupV2(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
+				_ = igmp.SendIGMPLeaveGroupV2(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
 			case IGMPMembershipReportV3:
 				log.Infof("Recieved IGMPMembershipReportV3 message on ONU channel")
-				igmp.SendIGMPMembershipReportV3(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
+				_ = igmp.SendIGMPMembershipReportV3(o.PonPortID, o.ID, o.Sn(), o.PortNo, o.HwAddress, stream)
 			default:
 				onuLogger.Warnf("Received unknown message data %v for type %v in OLT Channel", message.Data, message.Type)
 			}
@@ -534,14 +534,14 @@
 
 func (o *Onu) handleEAPOLStart(stream openolt.Openolt_EnableIndicationServer) {
 	log.Infof("Receive StartEAPOL message on ONU Channel")
-	eapol.SendEapStart(o.ID, o.PonPortID, o.Sn(), o.PortNo, o.HwAddress, o.InternalState, stream)
+	_ = eapol.SendEapStart(o.ID, o.PonPortID, o.Sn(), o.PortNo, o.HwAddress, o.InternalState, stream)
 	go func(delay time.Duration) {
 		time.Sleep(delay)
 		if (o.InternalState.Current() == "eap_start_sent" ||
 			o.InternalState.Current() == "eap_response_identity_sent" ||
 			o.InternalState.Current() == "eap_response_challenge_sent" ||
 			o.InternalState.Current() == "auth_failed") && common.Options.BBSim.AuthRetry {
-			o.InternalState.Event("start_auth")
+			_ = o.InternalState.Event("start_auth")
 		} else if o.InternalState.Current() == "eap_response_success_received" {
 			o.Backoff.Reset()
 		}
@@ -551,13 +551,13 @@
 func (o *Onu) handleDHCPStart(stream openolt.Openolt_EnableIndicationServer) {
 	log.Infof("Receive StartDHCP message on ONU Channel")
 	// FIXME use id, ponId as SendEapStart
-	dhcp.SendDHCPDiscovery(o.PonPort.Olt.ID, o.PonPortID, o.ID, o.Sn(), o.PortNo, o.InternalState, o.HwAddress, o.CTag, stream)
+	_ = dhcp.SendDHCPDiscovery(o.PonPort.Olt.ID, o.PonPortID, o.ID, o.Sn(), o.PortNo, o.InternalState, o.HwAddress, o.CTag, stream)
 	go func(delay time.Duration) {
 		time.Sleep(delay)
 		if (o.InternalState.Current() == "dhcp_discovery_sent" ||
 			o.InternalState.Current() == "dhcp_request_sent" ||
 			o.InternalState.Current() == "dhcp_failed") && common.Options.BBSim.DhcpRetry {
-			o.InternalState.Event("start_dhcp")
+			_ = o.InternalState.Event("start_dhcp")
 		} else if o.InternalState.Current() == "dhcp_ack_received" {
 			o.Backoff.Reset()
 		}
@@ -728,7 +728,7 @@
 	//     TODO: Implement some delay between the TestResponse and the TestResult
 	isTest, err := omcilib.IsTestRequest(HexDecode(msg.omciMsg.Pkt))
 	if (err == nil) && (isTest) {
-		o.sendTestResult(msg, stream)
+		_ = o.sendTestResult(msg, stream)
 	}
 }
 
@@ -803,7 +803,7 @@
 				// wait for Gem and then start auth
 				go func() {
 					for v := range o.GetGemPortChan() {
-						if v == true {
+						if v {
 							if err := o.InternalState.Event("start_auth"); err != nil {
 								onuLogger.Warnf("Can't go to auth_started: %v", err)
 							}
@@ -829,8 +829,8 @@
 		msg.Flow.Classifier.DstPort == uint32(67) &&
 		(msg.Flow.Classifier.OPbits == 0 || msg.Flow.Classifier.OPbits == 255) {
 
-		if o.Dhcp == true {
-			if o.DhcpFlowReceived == false {
+		if o.Dhcp {
+			if !o.DhcpFlowReceived {
 				// keep track that we received the DHCP Flows
 				// so that we can transition the state to dhcp_started
 				// this is needed as a check in case someone trigger DHCP from the CLI
@@ -840,7 +840,7 @@
 					// wait for Gem and then start DHCP
 					go func() {
 						for v := range o.GetGemPortChan() {
-							if v == true {
+							if v {
 								if err := o.InternalState.Event("start_dhcp"); err != nil {
 									log.Errorf("Can't go to dhcp_started: %v", err)
 								}
diff --git a/internal/bbsim/devices/onu_flow_test.go b/internal/bbsim/devices/onu_flow_test.go
index e1c801f..4ff33a7 100644
--- a/internal/bbsim/devices/onu_flow_test.go
+++ b/internal/bbsim/devices/onu_flow_test.go
@@ -52,7 +52,7 @@
 	onu := createMockOnu(1, 1, 900, 900, true, false)
 
 	flow := openolt.Flow{
-		FlowId: 64,
+		FlowId:     64,
 		Classifier: &openolt.Classifier{},
 	}
 	msg := OnuFlowUpdateMessage{
@@ -491,7 +491,7 @@
 	onu.FlowIds = []uint32{1, 2, 34, 64, 92}
 
 	flow := openolt.Flow{
-		FlowId: 64,
+		FlowId:     64,
 		Classifier: &openolt.Classifier{},
 	}
 	msg := OnuFlowUpdateMessage{
@@ -526,7 +526,7 @@
 	onu.FlowIds = []uint32{64}
 
 	flow := openolt.Flow{
-		FlowId: 64,
+		FlowId:     64,
 		Classifier: &openolt.Classifier{},
 	}
 	msg := OnuFlowUpdateMessage{
diff --git a/internal/bbsim/devices/onu_indications_test.go b/internal/bbsim/devices/onu_indications_test.go
index 37008a2..433b776 100644
--- a/internal/bbsim/devices/onu_indications_test.go
+++ b/internal/bbsim/devices/onu_indications_test.go
@@ -19,11 +19,12 @@
 import (
 	"context"
 	"errors"
+	"testing"
+	"time"
+
 	"github.com/opencord/voltha-protos/v2/go/openolt"
 	"google.golang.org/grpc"
 	"gotest.tools/assert"
-	"testing"
-	"time"
 )
 
 type mockStream struct {
@@ -56,9 +57,10 @@
 	ctx, cancel := context.WithCancel(context.TODO())
 	go onu.ProcessOnuMessages(ctx, stream, nil)
 	onu.InternalState.SetState("initialized")
-	onu.InternalState.Event("discover")
+	_ = onu.InternalState.Event("discover")
 
 	select {
+	default:
 	case <-time.After(90 * time.Millisecond):
 		assert.Equal(t, stream.CallCount, 1)
 		assert.Equal(t, stream.Calls[1].IntfId, onu.PonPortID)
@@ -79,9 +81,10 @@
 	ctx, cancel := context.WithCancel(context.TODO())
 	go onu.ProcessOnuMessages(ctx, stream, nil)
 	onu.InternalState.SetState("initialized")
-	onu.InternalState.Event("discover")
+	_ = onu.InternalState.Event("discover")
 
 	select {
+	default:
 	case <-time.After(400 * time.Millisecond):
 		assert.Equal(t, stream.CallCount, 4)
 	}
@@ -101,7 +104,7 @@
 	ctx, cancel := context.WithCancel(context.TODO())
 	go onu.ProcessOnuMessages(ctx, stream, nil)
 	onu.InternalState.SetState("initialized")
-	onu.InternalState.Event("discover")
+	_ = onu.InternalState.Event("discover")
 
 	go func() {
 		for calls := range stream.channel {
@@ -112,8 +115,8 @@
 	}()
 
 	select {
+	default:
 	case <-time.After(1 * time.Second):
-
 		assert.Equal(t, stream.CallCount, 2)
 	}
 	cancel()
diff --git a/internal/bbsim/devices/onu_state_machine_test.go b/internal/bbsim/devices/onu_state_machine_test.go
index b2b292b..fdecc3f 100644
--- a/internal/bbsim/devices/onu_state_machine_test.go
+++ b/internal/bbsim/devices/onu_state_machine_test.go
@@ -25,9 +25,9 @@
 func Test_Onu_StateMachine_enable(t *testing.T) {
 	onu := createTestOnu()
 	assert.Equal(t, onu.InternalState.Current(), "initialized")
-	onu.InternalState.Event("discover")
+	_ = onu.InternalState.Event("discover")
 	assert.Equal(t, onu.InternalState.Current(), "discovered")
-	onu.InternalState.Event("enable")
+	_ = onu.InternalState.Event("enable")
 	assert.Equal(t, onu.InternalState.Current(), "enabled")
 }
 
@@ -41,11 +41,11 @@
 	onu.EapolFlowReceived = true
 	onu.GemPortAdded = true
 	onu.Flows = []FlowKey{
-		FlowKey{ID: 1, Direction: "upstream"},
-		FlowKey{ID: 2, Direction: "downstream"},
+		{ID: 1, Direction: "upstream"},
+		{ID: 2, Direction: "downstream"},
 	}
 
-	onu.InternalState.Event("disable")
+	_ = onu.InternalState.Event("disable")
 	assert.Equal(t, onu.InternalState.Current(), "disabled")
 
 	assert.Equal(t, onu.DhcpFlowReceived, false)
@@ -100,7 +100,7 @@
 	// succeed
 	onu.EapolFlowReceived = true
 	onu.GemPortAdded = true
-	onu.InternalState.Event("start_auth")
+	_ = onu.InternalState.Event("start_auth")
 	assert.Equal(t, onu.InternalState.Current(), "auth_started")
 }
 
@@ -113,13 +113,13 @@
 	onu.InternalState.SetState("auth_started")
 
 	assert.Equal(t, onu.InternalState.Current(), "auth_started")
-	onu.InternalState.Event("eap_start_sent")
+	_ = onu.InternalState.Event("eap_start_sent")
 	assert.Equal(t, onu.InternalState.Current(), "eap_start_sent")
-	onu.InternalState.Event("eap_response_identity_sent")
+	_ = onu.InternalState.Event("eap_response_identity_sent")
 	assert.Equal(t, onu.InternalState.Current(), "eap_response_identity_sent")
-	onu.InternalState.Event("eap_response_challenge_sent")
+	_ = onu.InternalState.Event("eap_response_challenge_sent")
 	assert.Equal(t, onu.InternalState.Current(), "eap_response_challenge_sent")
-	onu.InternalState.Event("eap_response_success_received")
+	_ = onu.InternalState.Event("eap_response_success_received")
 	assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received")
 
 	// test that we can retrigger EAPOL
@@ -194,7 +194,7 @@
 	assert.Equal(t, onu.InternalState.Current(), "eap_response_success_received")
 
 	// default transition
-	onu.InternalState.Event("start_dhcp")
+	_ = onu.InternalState.Event("start_dhcp")
 	assert.Equal(t, onu.InternalState.Current(), "dhcp_started")
 }
 
@@ -207,11 +207,11 @@
 	onu.InternalState.SetState("dhcp_started")
 
 	assert.Equal(t, onu.InternalState.Current(), "dhcp_started")
-	onu.InternalState.Event("dhcp_discovery_sent")
+	_ = onu.InternalState.Event("dhcp_discovery_sent")
 	assert.Equal(t, onu.InternalState.Current(), "dhcp_discovery_sent")
-	onu.InternalState.Event("dhcp_request_sent")
+	_ = onu.InternalState.Event("dhcp_request_sent")
 	assert.Equal(t, onu.InternalState.Current(), "dhcp_request_sent")
-	onu.InternalState.Event("dhcp_ack_received")
+	_ = onu.InternalState.Event("dhcp_ack_received")
 	assert.Equal(t, onu.InternalState.Current(), "dhcp_ack_received")
 
 	// test that we can retrigger DHCP
diff --git a/internal/bbsim/devices/onu_test_helpers.go b/internal/bbsim/devices/onu_test_helpers.go
index b35dff0..5e4b584 100644
--- a/internal/bbsim/devices/onu_test_helpers.go
+++ b/internal/bbsim/devices/onu_test_helpers.go
@@ -19,11 +19,12 @@
 import (
 	"context"
 	"errors"
+	"net"
+	"time"
+
 	"github.com/opencord/voltha-protos/v2/go/openolt"
 	"github.com/opencord/voltha-protos/v2/go/tech_profile"
 	"google.golang.org/grpc"
-	"net"
-	"time"
 )
 
 type FlowAddSpy struct {
@@ -133,7 +134,7 @@
 	}
 	onu := CreateONU(&olt, &pon, 1, 900, 900, false, false, time.Duration(1*time.Millisecond), true)
 	// NOTE we need this in order to create the OnuChannel
-	onu.InternalState.Event("initialize")
+	_ = onu.InternalState.Event("initialize")
 	onu.DiscoveryRetryDelay = 100 * time.Millisecond
 	return onu
 }
diff --git a/internal/bbsim/devices/pon.go b/internal/bbsim/devices/pon.go
index 225a45f..54301fa 100644
--- a/internal/bbsim/devices/pon.go
+++ b/internal/bbsim/devices/pon.go
@@ -18,7 +18,6 @@
 
 import (
 	"bytes"
-	"errors"
 	"fmt"
 
 	"github.com/looplab/fsm"
@@ -163,7 +162,7 @@
 			return onu, nil
 		}
 	}
-	return nil, errors.New(fmt.Sprintf("Cannot find Onu with serial number %d in PonPort %d", sn, p.ID))
+	return nil, fmt.Errorf("Cannot find Onu with serial number %d in PonPort %d", sn, p.ID)
 }
 
 func (p PonPort) GetOnuById(id uint32) (*Onu, error) {
@@ -172,7 +171,7 @@
 			return onu, nil
 		}
 	}
-	return nil, errors.New(fmt.Sprintf("Cannot find Onu with id %d in PonPort %d", id, p.ID))
+	return nil, fmt.Errorf("Cannot find Onu with id %d in PonPort %d", id, p.ID)
 }
 
 // GetNumOfActiveOnus returns number of active ONUs for PON port