[VOL-5475] upgrade go to 1.24.5 and golangci-lint version to 2.2.2

Signed-off-by: mgouda <madhumati.gouda@radisys.com>
Change-Id: Ic9fe6b74bdb86f8313a04559b59991d66307d5bb
diff --git a/.golangci.yml b/.golangci.yml
index a19251f..a5fe01f 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
+version: "2"
 linters-settings:
   govet:
     settings:
@@ -41,17 +41,44 @@
      - govet
      - errcheck
      - goconst
-     - gofmt
      - whitespace
-     - goimports
-     - gosimple
      - ineffassign
      - gocyclo
      - misspell
      - staticcheck
      - unused
      - gosec
+  exclusions:
+    paths:
+      - '_test\.go$'
+      - voltha-go-controller/tests/mocks
+      - internal/test/mocks
+    rules:
+      - path: ".*_test.go"
+        linters:
+          - govet
+          - fieldalignment
+      - text: 'G114: Use of net/http serve function that has no support for setting timeouts'
+        linters:
+          - gosec
+      - text: 'G115: integer overflow conversion'
+        linters:
+          - gosec
+      - text: 'ST1005: error strings should not be capitalized'
+        linters:
+          - staticcheck
+      - text: 'QF1007: could merge conditional assignment into variable declaration'
+        linters:
+          - staticcheck
+      - text: 'QF1008: could remove embedded field'
+        linters:
+          - staticcheck
 
+
+formatters:
+  enable:
+    - gofmt
+    - goimports
 run:
   issues-exit-code: 1
   timeout: 10m
@@ -64,15 +91,15 @@
 # golangci.com configuration
 # https://github.com/golangci/golangci/wiki/Configuration
 service:
-  golangci-lint-version: 1.61.0 # use the fixed version to not introduce new linters unexpectedly
+  golangci-lint-version: 2.2.2 # use the fixed version to not introduce new linters unexpectedly
   prepare:
     - echo "here I can run custom commands, but no preparation needed for this repo"
-issues:
-  exclude:
-    - 'G114: Use of net/http serve function that has no support for setting timeouts'
-    - 'G115: integer overflow conversion'
-  exclude-rules:
-    - path: ".*_test.go"
-      linters:
-        - govet
-        - fieldalignment
\ No newline at end of file
+# issues:
+#   exclude:
+#     - 'G114: Use of net/http serve function that has no support for setting timeouts'
+#     - 'G115: integer overflow conversion'
+#   exclude-rules:
+#     - path: ".*_test.go"
+#       linters:
+#         - govet
+#         - fieldalignment
diff --git a/Makefile b/Makefile
index 9704de3..6285646 100644
--- a/Makefile
+++ b/Makefile
@@ -75,7 +75,7 @@
 test-short: ARGS=-short
 test-verbose: ARGS=-v
 # tool containers
-VOLTHA_TOOLS_VERSION ?= 3.1.1
+VOLTHA_TOOLS_VERSION ?= 3.1.3
 
 HADOLINT          = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-hadolint hadolint
 GOLANGCI_LINT     = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golangci-lint golangci-lint
@@ -148,7 +148,7 @@
 	@rm -rf ./sca-report
 	@mkdir -p ./sca-report
 	@echo "Running static code analysis..."
-	@${GOLANGCI_LINT} run --out-format junit-xml ./... | tee ./sca-report/sca-report.xml
+	@${GOLANGCI_LINT} run --output.text.path=stdout --output.junit-xml.path=./sca-report/sca-report.xml ./...
 	@echo ""
 	@echo "Static code analysis OK"
 
diff --git a/VERSION b/VERSION
index 699c6c6..1a03094 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.8
+0.1.9
diff --git a/docker/Dockerfile.voltha-go-controller b/docker/Dockerfile.voltha-go-controller
index aa454f3..7cce4f8 100644
--- a/docker/Dockerfile.voltha-go-controller
+++ b/docker/Dockerfile.voltha-go-controller
@@ -17,7 +17,7 @@
 # SPDX-License-Identifier: Apache-2.0
 # -----------------------------------------------------------------------
 
-FROM golang:1.23.1-alpine3.20 AS dev
+FROM golang:1.24.5-alpine3.22 AS dev
 
 RUN adduser -h /home/voltha-go-controller -s /bin/bash -D voltha-go-controller && \
     apk add --no-cache build-base=0.5-r3
@@ -47,10 +47,10 @@
 WORKDIR /go/src/voltha-go-controller/voltha-go-controller/cli
 RUN CGO_ENABLED=0 go build -a -v -o /app/vgcctl
 
-FROM golang:1.23.1-alpine3.20 AS prod
+FROM golang:1.24.5-alpine3.22 AS prod
 
 RUN adduser -h /home/voltha-go-controller -s /bin/bash -D voltha-go-controller && \
-    apk add --no-cache bash=5.2.26-r0
+    apk add --no-cache bash=5.2.37-r0
 # Set the working directory
 WORKDIR /app
 
@@ -58,10 +58,10 @@
 COPY --from=dev /app/voltha-go-controller /app
 COPY --from=dev /app/vgcctl /app
 
-RUN chown -R voltha-go-controller.voltha-go-controller /app/voltha-go-controller /usr/local/bin/ && \
-    apk add --no-cache openssh=9.7_p1-r5
+RUN chown -R voltha-go-controller:voltha-go-controller /app/voltha-go-controller /usr/local/bin/ && \
+    apk add --no-cache openssh=10.0_p1-r9
 
-ENV NOTVISIBLE "in users profile"
+ENV NOTVISIBLE="in users profile"
 RUN echo "export VISIBLE=now" >> /etc/profile
 
 EXPOSE 22
diff --git a/go.mod b/go.mod
index fab4181..474f98f 100755
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module voltha-go-controller
 
-go 1.23
+go 1.24.5
 
 replace (
 	github.com/coreos/bbolt v1.3.4 => go.etcd.io/bbolt v1.3.4
diff --git a/internal/pkg/application/application.go b/internal/pkg/application/application.go
index de67c02..e8bc663 100644
--- a/internal/pkg/application/application.go
+++ b/internal/pkg/application/application.go
@@ -37,7 +37,6 @@
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/intf"
 	"voltha-go-controller/internal/pkg/of"
@@ -1666,7 +1665,8 @@
 	if ipv4l != nil {
 		ip := ipv4l.(*layers.IPv4)
 
-		if ip.Protocol == layers.IPProtocolUDP {
+		switch ip.Protocol {
+		case layers.IPProtocolUDP:
 			logger.Debugw(ctx, "Received Southbound UDP ipv4 packet in", log.Fields{"StreamSide": packetSide})
 			dhcpl := gopkt.Layer(layers.LayerTypeDHCPv4)
 			if dhcpl != nil {
@@ -1676,7 +1676,7 @@
 					logger.Debugw(ctx, "DHCPv4 handler is not registered, dropping the packet", log.Fields{"Pkt": hex.EncodeToString(gopkt.Data())})
 				}
 			}
-		} else if ip.Protocol == layers.IPProtocolIGMP {
+		case layers.IPProtocolIGMP:
 			logger.Debugw(ctx, "Received Southbound IGMP packet in", log.Fields{"StreamSide": packetSide})
 			if callBack, ok := PacketHandlers[IGMP]; ok {
 				callBack(cntx, device, port, gopkt)
@@ -1924,7 +1924,7 @@
 // GetTaskList to get task list information.
 func (va *VoltApplication) GetTaskList(device string) map[int]*TaskInfo {
 	logger.Debugw(ctx, "Received Get Task List", log.Fields{"device": device})
-	taskList := cntlr.GetController().GetTaskList(device)
+	taskList := controller.GetController().GetTaskList(device)
 	taskMap := make(map[int]*TaskInfo)
 	for i, task := range taskList {
 		taskID := strconv.Itoa(int(task.TaskID()))
@@ -1947,8 +1947,8 @@
 	} else {
 		logger.Infow(ctx, "No device present with old serial number", log.Fields{"Serial Number": oldOltSlNo})
 		// Add Serial Number to Blocked Devices List.
-		cntlr.GetController().AddBlockedDevices(oldOltSlNo)
-		cntlr.GetController().AddBlockedDevices(newOltSlNo)
+		controller.GetController().AddBlockedDevices(oldOltSlNo)
+		controller.GetController().AddBlockedDevices(newOltSlNo)
 
 		updateSlNoForVnet := func(key, value interface{}) bool {
 			vnet := value.(*VoltVnet)
@@ -1979,8 +1979,8 @@
 		va.MvlanProfilesByName.Range(updateSlNoforMvlan)
 
 		// Clear the serial number from Blocked Devices List
-		cntlr.GetController().DelBlockedDevices(oldOltSlNo)
-		cntlr.GetController().DelBlockedDevices(newOltSlNo)
+		controller.GetController().DelBlockedDevices(oldOltSlNo)
+		controller.GetController().DelBlockedDevices(newOltSlNo)
 	}
 }
 
diff --git a/internal/pkg/application/dhcprelay.go b/internal/pkg/application/dhcprelay.go
index ef499bb..0e1f138 100644
--- a/internal/pkg/application/dhcprelay.go
+++ b/internal/pkg/application/dhcprelay.go
@@ -713,25 +713,20 @@
 	}
 
 	switch msgType {
-	case layers.DHCPMsgTypeDiscover, layers.DHCPMsgTypeRequest:
-		if msgType == layers.DHCPMsgTypeDiscover {
-			vpv.SetDhcpState(DhcpRelayStateDiscover)
-		} else if msgType == layers.DHCPMsgTypeRequest {
-			vpv.SetDhcpState(DhcpRelayStateRequest)
-		}
-	// Reset learnt mac address in case of DHCPv4 release
+	case layers.DHCPMsgTypeDiscover:
+		vpv.SetDhcpState(DhcpRelayStateDiscover)
+	case layers.DHCPMsgTypeRequest:
+		vpv.SetDhcpState(DhcpRelayStateRequest)
 	case layers.DHCPMsgTypeRelease:
 		vpv.LearntMacAddr, _ = net.ParseMAC("00:00:00:00:00:00")
 		vpv.services.Range(matchServiceAndRaiseInd)
 		vpv.SetDhcpState(DhcpRelayStateRelease)
-
-	case layers.DHCPMsgTypeAck, layers.DHCPMsgTypeNak:
+	case layers.DHCPMsgTypeAck:
 		vpv.services.Range(matchServiceAndRaiseInd)
-		if msgType == layers.DHCPMsgTypeAck {
-			vpv.SetDhcpState(DhcpRelayStateAck)
-		} else if msgType == layers.DHCPMsgTypeNak {
-			vpv.SetDhcpState(DhcpRelayStateNAK)
-		}
+		vpv.SetDhcpState(DhcpRelayStateAck)
+	case layers.DHCPMsgTypeNak:
+		vpv.services.Range(matchServiceAndRaiseInd)
+		vpv.SetDhcpState(DhcpRelayStateNAK)
 	case layers.DHCPMsgTypeOffer:
 		vpv.SetDhcpState(DhcpRelayStateOffer)
 	}
diff --git a/internal/pkg/application/igmp.go b/internal/pkg/application/igmp.go
index 4ce9849..9ab5e8e 100644
--- a/internal/pkg/application/igmp.go
+++ b/internal/pkg/application/igmp.go
@@ -812,7 +812,8 @@
 
 	logger.Debugw(ctx, "Received IGMPv2 Type", log.Fields{"Type": igmpv2.Type})
 
-	if igmpv2.Type == layers.IGMPMembershipReportV2 || igmpv2.Type == layers.IGMPMembershipReportV1 {
+	switch igmpv2.Type {
+	case layers.IGMPMembershipReportV2, layers.IGMPMembershipReportV1:
 		logger.Infow(ctx, "IGMP Join received: v2", log.Fields{"Addr": igmpv2.GroupAddress, "Port": port})
 
 		// This is a report coming from the PON. We must be able to first find the
@@ -884,7 +885,7 @@
 				return
 			}
 		}
-	} else if igmpv2.Type == layers.IGMPLeaveGroup {
+	case layers.IGMPLeaveGroup:
 		// This is a IGMP leave coming from one of the receivers. We essentially remove the
 		// the receiver.
 		logger.Infow(ctx, "IGMP Leave received: v2", log.Fields{"Addr": igmpv2.GroupAddress, "Port": port})
@@ -911,7 +912,7 @@
 				va.DelIgmpGroup(cntx, ig)
 			}
 		}
-	} else {
+	default:
 		// This must be a query on the NNI port. However, we dont make that assumption.
 		// Need to look for the IGMP group based on the VLAN in the packet as
 		// the MVLAN
diff --git a/internal/pkg/application/igmpgroup.go b/internal/pkg/application/igmpgroup.go
index 2dab424..ec4fbf0 100644
--- a/internal/pkg/application/igmpgroup.go
+++ b/internal/pkg/application/igmpgroup.go
@@ -515,7 +515,7 @@
 			// During vgc upgrade from old version, igd.NextQueryTime and igd.QueryExpiryTime will not be present in db.
 			// hence they are initialized with current time offset.
 			emptyTime := time.Time{}
-			if emptyTime == igd.NextQueryTime {
+			if emptyTime.Equal(igd.NextQueryTime) {
 				logger.Debugw(ctx, "VGC igd upgrade", log.Fields{"igd grp name": igd.GroupName})
 				igd.NextQueryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
 				igd.QueryExpiryTime = time.Now().Add(time.Duration(igd.proxyCfg.KeepAliveInterval) * time.Second)
diff --git a/internal/pkg/application/major_upgrade.go b/internal/pkg/application/major_upgrade.go
index 66408ca..55ea239 100644
--- a/internal/pkg/application/major_upgrade.go
+++ b/internal/pkg/application/major_upgrade.go
@@ -301,7 +301,7 @@
 
 		presentParams := migrationMap[module](cntx, b)
 		logger.Infow(ctx, "Migrated data", log.Fields{"presentParams": presentParams})
-		if "" == presentParams {
+		if presentParams == "" {
 			return errors.New("Error-in-migration")
 		} else if ModuleToBeDeleted == presentParams {
 			return nil
diff --git a/internal/pkg/application/meters.go b/internal/pkg/application/meters.go
index 1f6b41b..00ecd84 100644
--- a/internal/pkg/application/meters.go
+++ b/internal/pkg/application/meters.go
@@ -205,7 +205,7 @@
 	var aggVM *VoltMeter
 	vm, err := m.GetMeterByProfID(meterID)
 	if err == nil {
-		if 0 != aggMeterID { //Assuming valid meter id will never be 0
+		if aggMeterID != 0 { //Assuming valid meter id will never be 0
 			if aggVM, err = m.GetMeterByProfID(aggMeterID); err != nil {
 				logger.Warnw(ctx, "Aggregated Meter not found", log.Fields{"Id": aggMeterID})
 			}
diff --git a/internal/pkg/application/pppoeia.go b/internal/pkg/application/pppoeia.go
index 6459d4c..5920751 100644
--- a/internal/pkg/application/pppoeia.go
+++ b/internal/pkg/application/pppoeia.go
@@ -317,11 +317,12 @@
 	if vpv.PppoeIa {
 		// Delete the IA option that may be included in the response
 		DelIaOption(pppoe)
-		if pppoe.Code == layers.PPPoECodePADO {
+		switch pppoe.Code {
+		case layers.PPPoECodePADO:
 			vpv.SetPppoeIaState(PppoeIaStatePADO)
-		} else if pppoe.Code == layers.PPPoECodePADS {
+		case layers.PPPoECodePADS:
 			vpv.SetPppoeIaState(PppoeIaStatePADS)
-		} else if pppoe.Code == layers.PPPoECodePADT {
+		case layers.PPPoECodePADT:
 			vpv.SetPppoeIaState(PppoeIaStatePADT)
 		}
 		vpv.WriteToDb(cntx)
@@ -452,9 +453,10 @@
 			vpv.SetMacAddr(cntx, eth.SrcMAC)
 		}
 
-		if pppoe.Code == layers.PPPoECodePADI {
+		switch pppoe.Code {
+		case layers.PPPoECodePADI:
 			vpv.SetPppoeIaState(PppoeIaStatePADI)
-		} else if pppoe.Code == layers.PPPoECodePADR {
+		case layers.PPPoECodePADR:
 			vpv.SetPppoeIaState(PppoeIaStatePADR)
 		}
 		vpv.WriteToDb(cntx)
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index 3fd1a4e..b36cb8f 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -32,13 +32,11 @@
 	"strconv"
 	"strings"
 	"sync"
-	infraerrorCodes "voltha-go-controller/internal/pkg/errorcodes"
 
 	"github.com/google/gopacket/layers"
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/of"
 	"voltha-go-controller/internal/pkg/util"
@@ -304,12 +302,12 @@
 	logger.Debugw(ctx, "Add US & DS HSIA Flows for the service", log.Fields{"ServiceName": vs.Name})
 	if err := vs.AddUsHsiaFlows(cntx); err != nil {
 		logger.Errorw(ctx, "Error adding US HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 	if err := vs.AddDsHsiaFlows(cntx); err != nil {
 		logger.Errorw(ctx, "Error adding DS HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
@@ -319,13 +317,13 @@
 	logger.Debugw(ctx, "Delete US & DS HSIA Flows for the service", log.Fields{"ServiceName": vs.Name})
 	if err := vs.DelUsHsiaFlows(cntx, false); err != nil {
 		logger.Errorw(ctx, "Error deleting US HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 
 	if err := vs.DelDsHsiaFlows(cntx, false); err != nil {
 		logger.Errorw(ctx, "Error deleting DS HSIA Flows", log.Fields{"Service": vs.Name, "Port": vs.Port, "Reason": err.Error()})
-		statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+		statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 		vs.triggerServiceFailureInd(statusCode, statusMessage)
 	}
 }
@@ -384,14 +382,14 @@
 			usflows, err := vs.BuildUsHsiaFlows(pbits)
 			if err != nil {
 				logger.Errorw(ctx, "Error Building HSIA US flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
 			if err := vs.AddFlows(cntx, device, usflows); err != nil {
 				logger.Errorw(ctx, "Error adding HSIA US flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		}
@@ -432,7 +430,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.AddFlows(cntx, device, dsflows); err != nil {
 				logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else {
@@ -446,7 +444,7 @@
 				dsflows.MigrateCookie = vgcRebooted
 				if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 					logger.Errorw(ctx, "Failed to add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 				}
 			} else {
@@ -454,14 +452,14 @@
 					dsflows, err := vs.BuildDsHsiaFlows(of.PbitType(matchPbit))
 					if err != nil {
 						logger.Errorw(ctx, "Error Building HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err.Error()})
-						statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+						statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 						vs.triggerServiceFailureInd(statusCode, statusMessage)
 						continue
 					}
 					dsflows.MigrateCookie = vgcRebooted
 					if err := vs.AddFlows(cntx, device, dsflows); err != nil {
 						logger.Errorw(ctx, "Failed to Add HSIA DS flows", log.Fields{"Device": vs.Device, "Service": vs.Name, "Reason": err})
-						statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+						statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 						vs.triggerServiceFailureInd(statusCode, statusMessage)
 					}
 				}
@@ -493,14 +491,14 @@
 			usflows, err := vs.BuildUsHsiaFlows(pbits)
 			if err != nil {
 				logger.Errorw(ctx, "Error Building HSIA US flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 				continue
 			}
 			usflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, usflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA US flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		}
@@ -530,7 +528,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else if _, ok := vs.DsRemarkPbitsMap[int(PbitMatchAll)]; ok {
@@ -541,7 +539,7 @@
 			dsflows.MigrateCookie = vgcRebooted
 			if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 				logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-				statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+				statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 				vs.triggerServiceFailureInd(statusCode, statusMessage)
 			}
 		} else {
@@ -549,14 +547,14 @@
 				dsflows, err := vs.BuildDsHsiaFlows(of.PbitType(matchPbit))
 				if err != nil {
 					logger.Errorw(ctx, "Error Building HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 					continue
 				}
 				dsflows.MigrateCookie = vgcRebooted
 				if err = vs.DelFlows(cntx, device, dsflows, delFlowsInDevice); err != nil {
 					logger.Errorw(ctx, "Error Deleting HSIA DS flows", log.Fields{"Device": vs.Device, "ServiceName": vs.Name, "Reason": err.Error()})
-					statusCode, statusMessage := infraerrorCodes.GetErrorInfo(err)
+					statusCode, statusMessage := errorCodes.GetErrorInfo(err)
 					vs.triggerServiceFailureInd(statusCode, statusMessage)
 				}
 			}
@@ -807,10 +805,11 @@
 		subflow1.SetGoToTable(1)
 		subflow1.SetInPort(inport)
 
-		if vs.ServiceType == DpuMgmtTraffic {
+		switch vs.ServiceType {
+		case DpuMgmtTraffic:
 			subflow1.SetMatchPbit(vs.UsPonCTagPriority)
 			subflow1.SetPcp(vs.UsPonSTagPriority)
-		} else if vs.ServiceType == DpuAncpTraffic {
+		case DpuAncpTraffic:
 			subflow1.SetPcp(vs.UsPonSTagPriority)
 		}
 		if err := vs.setUSMatchActionVlanT0(subflow1); err != nil {
@@ -1334,7 +1333,7 @@
 		device.RegisterFlowAddEvent(cookie, fe)
 		vs.PendingFlows[cookie] = true
 	}
-	return cntlr.GetController().AddFlows(cntx, vs.Port, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, vs.Port, device.Name, flow)
 }
 
 // FlowInstallSuccess - Called when corresponding service flow installation is success
@@ -1424,7 +1423,7 @@
 			device.RegisterFlowDelEvent(cookie, fe)
 		}
 	}
-	return cntlr.GetController().DelFlows(cntx, vs.Port, device.Name, flow, delFlowsInDevice)
+	return controller.GetController().DelFlows(cntx, vs.Port, device.Name, flow, delFlowsInDevice)
 }
 
 // CheckAndDeleteService - remove service from DB is there are no pending flows to be removed
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index 2bbcd14..8a23636 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -34,7 +34,6 @@
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/controller"
-	cntlr "voltha-go-controller/internal/pkg/controller"
 
 	errorCodes "voltha-go-controller/internal/pkg/errorcodes"
 	"voltha-go-controller/internal/pkg/of"
@@ -663,9 +662,10 @@
 func (vpv *VoltPortVnet) ProcessDhcpResult(cntx context.Context, res *layers.DHCPv4) {
 	logger.Debug(ctx, "Process Dhcp Result")
 	msgType := DhcpMsgType(res)
-	if msgType == layers.DHCPMsgTypeAck {
+	switch msgType {
+	case layers.DHCPMsgTypeAck:
 		vpv.ProcessDhcpSuccess(cntx, res)
-	} else if msgType == layers.DHCPMsgTypeNak {
+	case layers.DHCPMsgTypeNak:
 		vpv.DhcpStatus = DhcpStatusNacked
 	}
 	vpv.WriteToDb(cntx)
@@ -1816,7 +1816,7 @@
 					vd.RegisterFlowAddEvent(cookie, fe)
 				}
 			}
-			if err1 := cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flows); err1 != nil {
+			if err1 := controller.GetController().AddFlows(cntx, vpv.Port, device.Name, flows); err1 != nil {
 				return err1
 			}
 		} else {
@@ -2718,14 +2718,14 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping Dev Flow Configuration - Port Down", log.Fields{"Device": device})
 				return true
 			}
 
 			// Pushing ICMPv6 Flow
 			flow := BuildICMPv6Flow(portID, vnet)
-			err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+			err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2734,7 +2734,7 @@
 
 			// Pushing ARP Flow
 			flow = BuildDSArpFlow(portID, vnet)
-			err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+			err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 			if err != nil {
 				logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 				return true
@@ -2752,7 +2752,7 @@
 
 func (va *VoltApplication) PushTrapFlows(cntx context.Context, device *VoltDevice, nniPort string, flow *of.VoltFlow) error {
 	logger.Debugw(ctx, "Push NNI DHCP Trap Flows", log.Fields{"DeviceName": device.Name, "Flow port": flow.PortID})
-	return cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 }
 
 // PushDevFlowForDevice to push icmpv6 flows for device
@@ -2786,7 +2786,7 @@
 			return true
 		}
 		flow := BuildICMPv6Flow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+		err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ICMPv6 Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2794,7 +2794,7 @@
 		logger.Infow(ctx, "ICMP Flow Added to Queue", log.Fields{"flow": flow})
 
 		flow = BuildDSArpFlow(nniPortID, vnet)
-		err = cntlr.GetController().AddFlows(cntx, nniPort, device.Name, flow)
+		err = controller.GetController().AddFlows(cntx, nniPort, device.Name, flow)
 		if err != nil {
 			logger.Warnw(ctx, "Configuring ARP Flow for device failed ", log.Fields{"Device": device.Name, "err": err})
 			return true
@@ -2830,7 +2830,7 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping ICMPv6 Flow Deletion - Port Down", log.Fields{"Device": device})
 				return true
 			}
@@ -2951,7 +2951,7 @@
 			return true
 		}
 		if portID, err := va.GetPortID(nniPort); err == nil {
-			if state, _ := cntlr.GetController().GetPortState(device.Name, nniPort); state != cntlr.PortStateUp {
+			if state, _ := controller.GetController().GetPortState(device.Name, nniPort); state != controller.PortStateUp {
 				logger.Warnw(ctx, "Skipping ICMPv6 Flow Deletion - Port Down", log.Fields{"Device": device})
 				return false
 			}
@@ -3087,7 +3087,7 @@
 	}
 	logger.Infow(ctx, "ICMPv6 MC Group Action", log.Fields{"Device": device, "Delete": delete})
 	port, _ := GetApplication().GetNniPort(device)
-	err := cntlr.GetController().GroupUpdate(port, device, group)
+	err := controller.GetController().GroupUpdate(port, device, group)
 	return err
 }
 
@@ -3124,7 +3124,7 @@
 		}
 		device.RegisterFlowAddEvent(cookie, fe)
 	}
-	return cntlr.GetController().AddFlows(cntx, vpv.Port, device.Name, flow)
+	return controller.GetController().AddFlows(cntx, vpv.Port, device.Name, flow)
 }
 
 // FlowInstallFailure - Process flow failure indication and triggers HSIA failure for all associated services
@@ -3156,7 +3156,7 @@
 		device.RegisterFlowDelEvent(cookie, fe)
 		vpv.PendingDeleteFlow[cookie] = true
 	}
-	return cntlr.GetController().DelFlows(cntx, vpv.Port, device.Name, flow, false)
+	return controller.GetController().DelFlows(cntx, vpv.Port, device.Name, flow, false)
 }
 
 // CheckAndDeleteVpv - remove VPV from DB is there are no pending flows to be removed
@@ -3240,7 +3240,7 @@
 		logger.Errorw(ctx, "Error getting NNI port", log.Fields{"Error": err})
 		return err
 	}
-	return cntlr.GetController().DelFlows(cntx, nniPort, device.Name, flow, false)
+	return controller.GetController().DelFlows(cntx, nniPort, device.Name, flow, false)
 }
 
 // CheckAndDeleteVnet - remove Vnet from DB is there are no pending flows to be removed
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index c146f23..54b6d22 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -73,14 +73,15 @@
 		portName := status.PortStatus.Desc.Name
 		state := status.PortStatus.Desc.State
 		logger.Infow(ctx, "Process Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
-		if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_ADD {
+		switch status.PortStatus.Reason {
+		case ofp.OfpPortReason_OFPPR_ADD:
 			_ = cet.device.AddPort(ctx, status.PortStatus.Desc)
 			if state == uint32(ofp.OfpPortState_OFPPS_LIVE) {
 				cet.device.ProcessPortState(ctx, portNo, state, portName)
 			}
-		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_DELETE {
+		case ofp.OfpPortReason_OFPPR_DELETE:
 			cet.device.CheckAndDeletePort(ctx, portNo, portName)
-		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_MODIFY {
+		case ofp.OfpPortReason_OFPPR_MODIFY:
 			cet.device.ProcessPortUpdate(ctx, portName, portNo, state)
 		}
 		logger.Debugw(ctx, "Processed Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index 73fc348..0748fa7 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -881,10 +881,11 @@
 	if p := d.GetPortByID(port); p != nil {
 		logger.Infow(ctx, "Port State Processing after Reboot", log.Fields{"Received": state, "Current": p.State, "port": port, "Device": d.ID})
 		p.Tasks.Initialize(d.ctx)
-		if p.State == PortStateUp {
+		switch p.State {
+		case PortStateUp:
 			logger.Debugw(ctx, "Port State: UP", log.Fields{"Device": d.ID, "Port": port})
 			GetController().PortUpInd(cntx, d.ID, p.Name)
-		} else if p.State == PortStateDown {
+		case PortStateDown:
 			logger.Debugw(ctx, "Port State: Down", log.Fields{"Device": d.ID, "Port": port})
 			GetController().PortDownInd(cntx, d.ID, p.Name)
 		}
diff --git a/internal/pkg/of/flows.go b/internal/pkg/of/flows.go
index e681752..48bb427 100644
--- a/internal/pkg/of/flows.go
+++ b/internal/pkg/of/flows.go
@@ -933,13 +933,14 @@
 			}
 		}
 
-		if f.Action.Output == OutputTypeToController {
+		switch f.Output {
+		case OutputTypeToController:
 			action := NewOutputAction(0xfffffffd)
 			actions.Actions = append(actions.Actions, action)
-		} else if f.Action.Output == OutputTypeToNetwork {
+		case OutputTypeToNetwork:
 			action := NewOutputAction(f.OutPort)
 			actions.Actions = append(actions.Actions, action)
-		} else if f.Action.Output == OutputTypeToGroup {
+		case OutputTypeToGroup:
 			action := NewGroupAction(f.OutPort)
 			actions.Actions = append(actions.Actions, action)
 		}
diff --git a/internal/pkg/vpagent/connection.go b/internal/pkg/vpagent/connection.go
index 971b8b4..738f88c 100644
--- a/internal/pkg/vpagent/connection.go
+++ b/internal/pkg/vpagent/connection.go
@@ -32,7 +32,7 @@
 
 func (vpa *VPAgent) establishConnectionToVoltha(ctx context.Context) error {
 	if vpa.volthaConnection != nil {
-		vpa.volthaConnection.Close()
+		_ = vpa.volthaConnection.Close()
 	}
 
 	vpa.volthaConnection = nil
@@ -74,5 +74,5 @@
 func (vpa *VPAgent) CloseConnectionToVoltha() {
 	// Close the grpc connection to voltha
 	logger.Debug(ctx, "Closing voltha grpc connection")
-	vpa.volthaConnection.Close()
+	_ = vpa.volthaConnection.Close()
 }
diff --git a/voltha-go-controller/cli/commands/util.go b/voltha-go-controller/cli/commands/util.go
index e375618..42e6a0f 100644
--- a/voltha-go-controller/cli/commands/util.go
+++ b/voltha-go-controller/cli/commands/util.go
@@ -44,7 +44,7 @@
 	}
 
 	if resp.Body != nil {
-		defer resp.Body.Close()
+		defer func() { _ = resp.Body.Close() }()
 	}
 
 	body, readErr := io.ReadAll(resp.Body)
@@ -85,7 +85,7 @@
 	}
 
 	if resp.Body != nil {
-		defer resp.Body.Close()
+		defer func() { _ = resp.Body.Close() }()
 	}
 
 	body, readErr := io.ReadAll(resp.Body)
diff --git a/voltha-go-controller/cli/format/vertical.go b/voltha-go-controller/cli/format/vertical.go
index 2d01278..21d3692 100644
--- a/voltha-go-controller/cli/format/vertical.go
+++ b/voltha-go-controller/cli/format/vertical.go
@@ -288,30 +288,32 @@
 		var rStatev6 string
 
 		// Checking for state-DHCPv4
-		if value[i].State == "0" {
+		switch value[i].State {
+		case "0":
 			rState = "None"
-		} else if value[i].State == "1" {
+		case "1":
 			rState = "Discover"
-		} else if value[i].State == "2" {
+		case "2":
 			rState = "Offer"
-		} else if value[i].State == "3" {
+		case "3":
 			rState = "Request"
-		} else if value[i].State == "4" {
+		case "4":
 			rState = "Ack"
-		} else if value[i].State == "5" {
+		case "5":
 			rState = "NAK"
-		} else if value[i].State == "6" {
+		case "6":
 			rState = "Release"
 		}
 
 		// Checking for state-DHCPv6
-		if value[i].Statev6 == "0" {
+		switch value[i].Statev6 {
+		case "0":
 			rStatev6 = "None"
-		} else if value[i].Statev6 == "1" {
+		case "1":
 			rStatev6 = "Solicit"
-		} else if value[i].Statev6 == "2" {
+		case "2":
 			rStatev6 = "Reply"
-		} else if value[i].Statev6 == "3" {
+		case "3":
 			rStatev6 = "Release"
 		}
 
diff --git a/voltha-go-controller/main.go b/voltha-go-controller/main.go
index ac69cbf..9070a88 100644
--- a/voltha-go-controller/main.go
+++ b/voltha-go-controller/main.go
@@ -26,7 +26,6 @@
 
 	pc "voltha-go-controller/infra/pprofcontroller"
 
-	"voltha-go-controller/database"
 	db "voltha-go-controller/database"
 	app "voltha-go-controller/internal/pkg/application"
 	"voltha-go-controller/internal/pkg/controller"
@@ -51,7 +50,7 @@
 }
 
 var vgcInfo = VgcInfo{Name: "VGC"}
-var dbHandler *database.Database
+var dbHandler *db.Database
 
 func printBanner() {
 	fmt.Println("##     ##  ######    ######  ")
diff --git a/voltha-go-controller/nbi/subscriber.go b/voltha-go-controller/nbi/subscriber.go
index 31410ae..67e1f00 100644
--- a/voltha-go-controller/nbi/subscriber.go
+++ b/voltha-go-controller/nbi/subscriber.go
@@ -231,12 +231,12 @@
 			vnetcfg.UsDhcpPbit = append(vnetcfg.UsDhcpPbit, of.PbitType(uniTagInfo.UsPonSTagPriority))
 		}
 		if vs.CVlan != of.VlanAny && vs.SVlan != of.VlanAny {
-			if uniTagInfo.ServiceName == app.DpuMgmtTraffic ||
-				uniTagInfo.ServiceName == app.DpuAncpTraffic {
+			switch uniTagInfo.ServiceName {
+			case app.DpuMgmtTraffic, app.DpuAncpTraffic:
 				vnetcfg.VlanControl = app.ONUCVlan
-			} else if uniTagInfo.ServiceName == app.FttbSubscriberTraffic {
+			case app.FttbSubscriberTraffic:
 				vnetcfg.VlanControl = app.OLTSVlan
-			} else {
+			default:
 				vnetcfg.VlanControl = app.ONUCVlanOLTSVlan
 			}
 		} else if vs.CVlan == of.VlanAny && vs.UniVlan == of.VlanAny {
diff --git a/voltha-go-controller/onos_nbi/models.go b/voltha-go-controller/onos_nbi/models.go
index 0b7ebff..89e332d 100644
--- a/voltha-go-controller/onos_nbi/models.go
+++ b/voltha-go-controller/onos_nbi/models.go
@@ -516,13 +516,14 @@
 
 func FlowStateMapping(state uint8) string {
 	var flowState string
-	if state == of.FlowAddSuccess {
+	switch state {
+	case of.FlowAddSuccess:
 		flowState = Added
-	} else if state == of.FlowAddFailure {
+	case of.FlowAddFailure:
 		flowState = FailedAdd
-	} else if state == of.FlowAddPending {
+	case of.FlowAddPending:
 		flowState = PendingAdd
-	} else if state == of.FlowDelPending {
+	case of.FlowDelPending:
 		flowState = PendingRemove
 	}
 	return flowState
@@ -812,11 +813,15 @@
 			}
 			bucket = append(bucket, bkt)
 		}
-		if groupsInfo.State == of.GroupOperSuccess {
+		if groups == nil {
+			groups = &GroupsInfo{}
+		}
+		switch groupsInfo.State {
+		case of.GroupOperSuccess:
 			groups.State = Added
-		} else if groupsInfo.State == of.GroupOperFailure {
+		case of.GroupOperFailure:
 			groups.State = Failed
-		} else if groupsInfo.State == of.GroupOperPending {
+		case of.GroupOperPending:
 			groups.State = Pending
 		}
 		groups = &GroupsInfo{
@@ -841,11 +846,12 @@
 		}
 		bd = append(bd, bnd)
 	}
-	if meterInfo.State == of.MeterOperSuccess {
+	switch meterInfo.State {
+	case of.MeterOperSuccess:
 		meter.State = Added
-	} else if meterInfo.State == of.MeterOperFailure {
+	case of.MeterOperFailure:
 		meter.State = Failed
-	} else if meterInfo.State == of.MeterOperPending {
+	case of.MeterOperPending:
 		meter.State = Pending
 	}
 	meter = Meters{