Fixing golang linters for VGC

Change-Id: I386d232c74ab47e24d92c18800dc144120b920da
diff --git a/internal/pkg/controller/addflows.go b/internal/pkg/controller/addflows.go
index a4bf35c..b303947 100644
--- a/internal/pkg/controller/addflows.go
+++ b/internal/pkg/controller/addflows.go
@@ -11,32 +11,32 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
 import (
 	"context"
+	"time"
 	infraerror "voltha-go-controller/internal/pkg/errorcodes"
 	infraerrorcode "voltha-go-controller/internal/pkg/errorcodes/service"
-	"time"
 
 	"voltha-go-controller/internal/pkg/of"
 	"voltha-go-controller/log"
 )
 
 const (
-	//MaxRetryCount - Maximum retry attempts on failure
+	// MaxRetryCount - Maximum retry attempts on failure
 	MaxRetryCount int = 1
 )
 
 // AddFlowsTask structure
 type AddFlowsTask struct {
-	taskID    uint8
 	ctx       context.Context
 	flow      *of.VoltFlow
 	device    *Device
 	timestamp string
+	taskID    uint8
 }
 
 // NewAddFlowsTask is constructor for AddFlowsTask
@@ -84,7 +84,7 @@
 		logger.Infow(ctx, "Flow Mod Request", log.Fields{"Cookie": flow.Cookie, "Oper": aft.flow.Command, "Port": aft.flow.PortID})
 		if aft.flow.Command == of.CommandAdd {
 			flow.State = of.FlowAddPending
-			if err := aft.device.AddFlow(ctx, flow); err != nil {
+			if err = aft.device.AddFlow(ctx, flow); err != nil {
 				logger.Warnw(ctx, "Add Flow Error", log.Fields{"Cookie": flow.Cookie, "Reason": err.Error()})
 
 				// If flow already exists in cache, check for flow state
@@ -161,7 +161,6 @@
 				break
 			}
 			aft.device.triggerFlowNotification(ctx, flow.FlowMod.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
-
 		} else {
 			logger.Errorw(ctx, "Update Flow Table Failed: Voltha Client Unavailable", log.Fields{"Flow": flow})
 		}
@@ -178,7 +177,6 @@
 
 	if oper == of.CommandAdd && volthaErrorCode == infraerrorcode.ErrAlreadyExists {
 		return true
-
 	} else if oper == of.CommandDel && volthaErrorCode == infraerrorcode.ErrNotExists {
 		return true
 	}
diff --git a/internal/pkg/controller/auditdevice.go b/internal/pkg/controller/auditdevice.go
index 2ba8772..b322737 100644
--- a/internal/pkg/controller/auditdevice.go
+++ b/internal/pkg/controller/auditdevice.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -21,6 +21,7 @@
 
 	"voltha-go-controller/internal/pkg/tasks"
 	"voltha-go-controller/log"
+
 	"github.com/opencord/voltha-protos/v5/go/common"
 	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
 )
@@ -42,12 +43,12 @@
 
 // AuditDevice structure
 type AuditDevice struct {
-	taskID    uint8
 	ctx       context.Context
 	device    *Device
-	stop      bool
 	timestamp string
 	event     AuditEventType
+	taskID    uint8
+	stop      bool
 }
 
 // NewAuditDevice is constructor for AuditDevice
@@ -88,7 +89,7 @@
 	ad.ctx = ctx
 
 	if ad.stop {
-		logger.Errorw(ctx, "Audit Device Task Cancelled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
+		logger.Errorw(ctx, "Audit Device Task Canceled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
 		return tasks.ErrTaskCancelError
 	}
 
@@ -133,7 +134,6 @@
 			excessPorts = append(excessPorts, id)
 		}
 		logger.Debugw(ctx, "Processed Port State Ind", log.Fields{"Port No": vgcPort.ID, "Port Name": vgcPort.Name})
-
 	}
 
 	// 1st process the NNI port before all other ports so that the device state can be updated.
@@ -155,7 +155,7 @@
 	GetController().ResetAuditFlags(ad.device)
 
 	if ad.stop {
-		logger.Errorw(ctx, "Audit Device Task Cancelled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
+		logger.Errorw(ctx, "Audit Device Task Canceled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
 		return tasks.ErrTaskCancelError
 	}
 	ad.AddMissingPorts(ctx, missingPorts)
@@ -181,7 +181,6 @@
 			ad.device.ProcessPortState(cntx, mp.PortNo, mp.State)
 		}
 		logger.Debugw(ctx, "Processed Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
-
 	}
 
 	// 1st process the NNI port before all other ports so that the flow provisioning for UNIs can be enabled
diff --git a/internal/pkg/controller/audittables.go b/internal/pkg/controller/audittables.go
index 334ce41..26b250e 100644
--- a/internal/pkg/controller/audittables.go
+++ b/internal/pkg/controller/audittables.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -25,6 +25,7 @@
 	"voltha-go-controller/internal/pkg/tasks"
 	"voltha-go-controller/internal/pkg/util"
 	"voltha-go-controller/log"
+
 	"github.com/opencord/voltha-protos/v5/go/common"
 	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
 	"github.com/opencord/voltha-protos/v5/go/voltha"
@@ -38,11 +39,11 @@
 
 // AuditTablesTask structure
 type AuditTablesTask struct {
-	taskID    uint8
 	ctx       context.Context
 	device    *Device
-	stop      bool
 	timestamp string
+	taskID    uint8
+	stop      bool
 }
 
 // NewAuditTablesTask is constructor for AuditTablesTask
@@ -114,7 +115,6 @@
 	att.DelExcessGroups(rcvdGroups)
 	logger.Warnw(ctx, "Audit Table Task Completed", log.Fields{"Context": ctx, "taskId": taskID, "Device": att.device.ID})
 	return errInfo
-
 }
 
 // AuditMeters : Audit the meters which includes fetching the existing meters at the
@@ -122,7 +122,6 @@
 // ones held at VOLTHA. The delta must be cleaned up to keep both the
 // components in sync
 func (att *AuditTablesTask) AuditMeters() error {
-
 	if att.stop {
 		return tasks.ErrTaskCancelError
 	}
@@ -150,7 +149,6 @@
 	// Verify all meters that are in the controller but not in the device
 	missingMeters := []*of.Meter{}
 	for _, meter := range att.device.meters {
-
 		if att.stop {
 			break
 		}
@@ -218,7 +216,6 @@
 // ones held at VOLTHA. The delta must be cleaned up to keep both the
 // components in sync
 func (att *AuditTablesTask) AuditFlows(cntx context.Context) error {
-
 	if att.stop {
 		return tasks.ErrTaskCancelError
 	}
@@ -256,7 +253,6 @@
 	att.device.flowLock.Lock()
 	// Verify all flows that are in the controller but not in the device
 	for _, flow := range att.device.flows {
-
 		if att.stop {
 			break
 		}
@@ -336,7 +332,6 @@
 
 	// Let's cycle through the flows to delete the excess flows
 	for _, flow := range flows {
-
 		if _, present := att.device.GetFlow(flow.Cookie); present {
 			logger.Warnw(ctx, "Flow Present in DB. Ignoring Delete Excess Flow", log.Fields{"Device": att.device.ID, "Cookie": flow.Cookie})
 			continue
@@ -377,7 +372,6 @@
 // ones held at VOLTHA. The delta must be cleaned up to keep both the
 // components in sync
 func (att *AuditTablesTask) AuditGroups() (map[uint32]*ofp.OfpGroupDesc, error) {
-
 	// Build the map for easy and faster processing
 	rcvdGroups = make(map[uint32]*ofp.OfpGroupDesc)
 
@@ -431,7 +425,6 @@
 
 // compareGroupEntries to compare the group entries
 func (att *AuditTablesTask) compareGroupEntries(key, value interface{}) bool {
-
 	if att.stop {
 		return false
 	}
@@ -454,12 +447,11 @@
 }
 
 func compareGroupMembers(refGroup *of.Group, rcvdGroup *ofp.OfpGroupDesc) {
-
 	portList := []uint32{}
 	refPortList := []uint32{}
 
-	//Collect port list from response Group Mod structure
-	//If PON is configured even for one group, then only PON shall be considered for compared for all groups
+	// Collect port list from response Group Mod structure
+	// If PON is configured even for one group, then only PON shall be considered for compared for all groups
 	for _, bucket := range rcvdGroup.Buckets {
 		for _, actionBucket := range bucket.Actions {
 			if actionBucket.Type == ofp.OfpActionType_OFPAT_OUTPUT {
@@ -471,18 +463,18 @@
 
 	refPortList = append(refPortList, refGroup.Buckets...)
 
-	//Is port list differs, trigger group update
+	// Is port list differs, trigger group update
 	if !util.IsSliceSame(refPortList, portList) {
 		groupsToMod = append(groupsToMod, refGroup)
 	}
 }
 
-//AddMissingGroups - addmissing groups to Voltha
+// AddMissingGroups - addmissing groups to Voltha
 func (att *AuditTablesTask) AddMissingGroups(groupList []*of.Group) {
 	att.PushGroups(groupList, of.GroupCommandAdd)
 }
 
-//UpdateMismatchGroups - updates mismatched groups to Voltha
+// UpdateMismatchGroups - updates mismatched groups to Voltha
 func (att *AuditTablesTask) UpdateMismatchGroups(groupList []*of.Group) {
 	att.PushGroups(groupList, of.GroupCommandMod)
 }
@@ -522,7 +514,7 @@
 		group.Device = att.device.ID
 		group.GroupID = groupDesc.GroupId
 
-		//Group Members should be deleted before triggered group delete
+		// Group Members should be deleted before triggered group delete
 		group.Command = of.GroupCommandMod
 		groupUpdate := of.CreateGroupTableUpdate(group)
 		if _, err := vc.UpdateLogicalDeviceFlowGroupTable(att.ctx, groupUpdate); err != nil {
@@ -538,119 +530,115 @@
 }
 
 func (att *AuditTablesTask) AuditPorts() error {
+	if att.stop {
+		return tasks.ErrTaskCancelError
+	}
 
-        if att.stop {
-                return tasks.ErrTaskCancelError
-        }
+	var vc voltha.VolthaServiceClient
+	if vc = att.device.VolthaClient(); vc == nil {
+		logger.Error(ctx, "Flow Audit Failed: Voltha Client Unavailable")
+		return nil
+	}
+	ofpps, err := vc.ListLogicalDevicePorts(att.ctx, &common.ID{Id: att.device.ID})
+	if err != nil {
+		return err
+	}
 
-        var vc voltha.VolthaServiceClient
-        if vc = att.device.VolthaClient(); vc == nil {
-                logger.Error(ctx, "Flow Audit Failed: Voltha Client Unavailable")
-                return nil
-        }
-        ofpps, err := vc.ListLogicalDevicePorts(att.ctx, &common.ID{Id: att.device.ID})
-        if err != nil {
-                return err
-        }
+	// Compute the difference between the ports received and ports at VGC
+	// First build a map of all the received ports under missing ports. We
+	// will eliminate the ports that are in the device from the missing ports
+	// so that the elements remaining are missing ports. The ones that are
+	// not in missing ports are added to excess ports which should be deleted
+	// from the VGC.
+	missingPorts := make(map[uint32]*ofp.OfpPort)
+	for _, ofpp := range ofpps.Items {
+		missingPorts[ofpp.OfpPort.PortNo] = ofpp.OfpPort
+	}
 
-        // Compute the difference between the ports received and ports at VGC
-        // First build a map of all the received ports under missing ports. We
-        // will eliminate the ports that are in the device from the missing ports
-        // so that the elements remaining are missing ports. The ones that are
-        // not in missing ports are added to excess ports which should be deleted
-        // from the VGC.
-        missingPorts := make(map[uint32]*ofp.OfpPort)
-        for _, ofpp := range ofpps.Items {
-                missingPorts[ofpp.OfpPort.PortNo] = ofpp.OfpPort
-        }
+	var excessPorts []uint32
+	processPortState := func(id uint32, vgcPort *DevicePort) {
+		logger.Debugw(ctx, "Process Port State Ind", log.Fields{"Port No": vgcPort.ID, "Port Name": vgcPort.Name})
 
-        var excessPorts []uint32
-        processPortState := func(id uint32, vgcPort *DevicePort) {
-                logger.Debugw(ctx, "Process Port State Ind", log.Fields{"Port No": vgcPort.ID, "Port Name": vgcPort.Name})
+		if ofpPort, ok := missingPorts[id]; ok {
+			if ((vgcPort.State == PortStateDown) && (ofpPort.State == uint32(ofp.OfpPortState_OFPPS_LIVE))) || ((vgcPort.State == PortStateUp) && (ofpPort.State != uint32(ofp.OfpPortState_OFPPS_LIVE))) {
+				// This port exists in the received list and the map at
+				// VGC. This is common so delete it
+				logger.Infow(ctx, "Port State Mismatch", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
+				att.device.ProcessPortState(ctx, ofpPort.PortNo, ofpPort.State)
+			}
+			delete(missingPorts, id)
+		} else {
+			// This port is missing from the received list. This is an
+			// excess port at VGC. This must be added to excess ports
+			excessPorts = append(excessPorts, id)
+		}
+		logger.Debugw(ctx, "Processed Port State Ind", log.Fields{"Port No": vgcPort.ID, "Port Name": vgcPort.Name})
+	}
+	// 1st process the NNI port before all other ports so that the device state can be updated.
+	if vgcPort, ok := att.device.PortsByID[NNIPortID]; ok {
+		logger.Info(ctx, "Processing NNI port state")
+		processPortState(NNIPortID, vgcPort)
+	}
 
-                if ofpPort, ok := missingPorts[id]; ok {
-                        if ((vgcPort.State == PortStateDown) && (ofpPort.State == uint32(ofp.OfpPortState_OFPPS_LIVE))) || ((vgcPort.State == PortStateUp) && (ofpPort.State != uint32(ofp.OfpPortState_OFPPS_LIVE))) {
-                                // This port exists in the received list and the map at
-                                // VGC. This is common so delete it
-                                logger.Infow(ctx, "Port State Mismatch", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
-                                att.device.ProcessPortState(ctx, ofpPort.PortNo, ofpPort.State)
-                        }
-                        delete(missingPorts, id)
-                } else {
-                        // This port is missing from the received list. This is an
-                        // excess port at VGC. This must be added to excess ports
-                        excessPorts = append(excessPorts, id)
-                }
-                logger.Debugw(ctx, "Processed Port State Ind", log.Fields{"Port No": vgcPort.ID, "Port Name": vgcPort.Name})
-
-        }
-        // 1st process the NNI port before all other ports so that the device state can be updated.
-        if vgcPort, ok := att.device.PortsByID[NNIPortID]; ok {
-                logger.Info(ctx, "Processing NNI port state")
-                processPortState(NNIPortID, vgcPort)
-        }
-
-        for id, vgcPort := range att.device.PortsByID {
-                if id == NNIPortID {
-                        //NNI port already processed
-                        continue
-                }
-                if att.stop {
-                        break
-                }
-                processPortState(id, vgcPort)
-        }
+	for id, vgcPort := range att.device.PortsByID {
+		if id == NNIPortID {
+			// NNI port already processed
+			continue
+		}
+		if att.stop {
+			break
+		}
+		processPortState(id, vgcPort)
+	}
 
 	if att.stop {
-                logger.Errorw(ctx, "Audit Device Task Cancelled", log.Fields{"Context": att.ctx, "Task": att.taskID})
-                return tasks.ErrTaskCancelError
-        }
-        att.AddMissingPorts(ctx, missingPorts)
-        att.DelExcessPorts(ctx, excessPorts)
+		logger.Errorw(ctx, "Audit Device Task Canceled", log.Fields{"Context": att.ctx, "Task": att.taskID})
+		return tasks.ErrTaskCancelError
+	}
+	att.AddMissingPorts(ctx, missingPorts)
+	att.DelExcessPorts(ctx, excessPorts)
 	return nil
 }
 
 // AddMissingPorts to add the missing ports
 func (att *AuditTablesTask) AddMissingPorts(cntx context.Context, mps map[uint32]*ofp.OfpPort) {
-        logger.Debugw(ctx, "Device Audit - Add Missing Ports", log.Fields{"NumPorts": len(mps)})
+	logger.Debugw(ctx, "Device Audit - Add Missing Ports", log.Fields{"NumPorts": len(mps)})
 
-        addMissingPort := func(mp *ofp.OfpPort) {
-                logger.Debugw(ctx, "Process Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
+	addMissingPort := func(mp *ofp.OfpPort) {
+		logger.Debugw(ctx, "Process Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
 
-                // Error is ignored as it only drops duplicate ports
-                logger.Infow(ctx, "Calling AddPort", log.Fields{"No": mp.PortNo, "Name": mp.Name})
-                if err := att.device.AddPort(cntx, mp); err != nil {
-                        logger.Warnw(ctx, "AddPort Failed", log.Fields{"No": mp.PortNo, "Name": mp.Name, "Reason": err})
-                }
-                if mp.State == uint32(ofp.OfpPortState_OFPPS_LIVE) {
-                        att.device.ProcessPortState(cntx, mp.PortNo, mp.State)
-                }
-                logger.Debugw(ctx, "Processed Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
+		// Error is ignored as it only drops duplicate ports
+		logger.Infow(ctx, "Calling AddPort", log.Fields{"No": mp.PortNo, "Name": mp.Name})
+		if err := att.device.AddPort(cntx, mp); err != nil {
+			logger.Warnw(ctx, "AddPort Failed", log.Fields{"No": mp.PortNo, "Name": mp.Name, "Reason": err})
+		}
+		if mp.State == uint32(ofp.OfpPortState_OFPPS_LIVE) {
+			att.device.ProcessPortState(cntx, mp.PortNo, mp.State)
+		}
+		logger.Debugw(ctx, "Processed Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
+	}
 
-        }
+	// 1st process the NNI port before all other ports so that the flow provisioning for UNIs can be enabled
+	if mp, ok := mps[NNIPortID]; ok {
+		logger.Info(ctx, "Adding Missing NNI port")
+		addMissingPort(mp)
+	}
 
-        // 1st process the NNI port before all other ports so that the flow provisioning for UNIs can be enabled
-        if mp, ok := mps[NNIPortID]; ok {
-                logger.Info(ctx, "Adding Missing NNI port")
-                addMissingPort(mp)
-        }
-
-        for portNo, mp := range mps {
-                if portNo != NNIPortID {
-                        addMissingPort(mp)
-                }
-        }
+	for portNo, mp := range mps {
+		if portNo != NNIPortID {
+			addMissingPort(mp)
+		}
+	}
 }
 
 // DelExcessPorts to delete the excess ports
 func (att *AuditTablesTask) DelExcessPorts(cntx context.Context, eps []uint32) {
-        logger.Debugw(ctx, "Device Audit - Delete Excess Ports", log.Fields{"NumPorts": len(eps)})
-        for _, id := range eps {
-                // Now delete the port from the device @ VGC
-                logger.Infow(ctx, "Device Audit - Deleting Port", log.Fields{"PortId": id})
-                if err := att.device.DelPort(cntx, id); err != nil {
-                        logger.Warnw(ctx, "DelPort Failed", log.Fields{"PortId": id, "Reason": err})
-                }
-        }
+	logger.Debugw(ctx, "Device Audit - Delete Excess Ports", log.Fields{"NumPorts": len(eps)})
+	for _, id := range eps {
+		// Now delete the port from the device @ VGC
+		logger.Infow(ctx, "Device Audit - Deleting Port", log.Fields{"PortId": id})
+		if err := att.device.DelPort(cntx, id); err != nil {
+			logger.Warnw(ctx, "DelPort Failed", log.Fields{"PortId": id, "Reason": err})
+		}
+	}
 }
-
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index 9a14d1a..77e7e68 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -21,16 +21,17 @@
 	"time"
 
 	"voltha-go-controller/log"
+
 	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
 )
 
 // ChangeEventTask structure
 type ChangeEventTask struct {
-	taskID    uint8
 	ctx       context.Context
 	event     *ofp.ChangeEvent
 	device    *Device
 	timestamp string
+	taskID    uint8
 }
 
 // NewChangeEventTask is constructor for ChangeEventTask
diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go
index 1e76e9e..ffead2b 100644
--- a/internal/pkg/controller/controller.go
+++ b/internal/pkg/controller/controller.go
@@ -50,17 +50,17 @@
 
 // VoltController structure
 type VoltController struct {
-	rebootLock              sync.Mutex
-	rebootInProgressDevices map[string]string
-	devices                 map[string]*Device
-	deviceLock              sync.RWMutex
-	vagent                  map[string]*vpagent.VPAgent
 	ctx                     context.Context
 	app                     intf.App
-	RebootFlow              bool
 	BlockedDeviceList       *util.ConcurrentMap
 	deviceTaskQueue         *util.ConcurrentMap
+	vagent                  map[string]*vpagent.VPAgent
+	devices                 map[string]*Device
+	rebootInProgressDevices map[string]string
+	deviceLock              sync.RWMutex
+	rebootLock              sync.Mutex
 	deviceTableSyncDuration time.Duration
+	RebootFlow              bool
 }
 
 var vcontroller *VoltController
@@ -81,20 +81,19 @@
 	return &controller
 }
 
-//SetDeviceTableSyncDuration - sets interval between device table sync up activity
-//  duration - in minutes
+// SetDeviceTableSyncDuration - sets interval between device table sync up activity
+// duration - in minutes
 func (v *VoltController) SetDeviceTableSyncDuration(duration int) {
 	v.deviceTableSyncDuration = time.Duration(duration) * time.Second
 }
 
-//GetDeviceTableSyncDuration - returns configured device table sync duration
+// GetDeviceTableSyncDuration - returns configured device table sync duration
 func (v *VoltController) GetDeviceTableSyncDuration() time.Duration {
 	return v.deviceTableSyncDuration
 }
 
 // AddDevice to add device
 func (v *VoltController) AddDevice(cntx context.Context, config *intf.VPClientCfg) intf.IVPClient {
-
 	d := NewDevice(cntx, config.DeviceID, config.SerialNum, config.VolthaClient, config.SouthBoundID, config.MfrDesc, config.HwDesc, config.SwDesc)
 	v.devices[config.DeviceID] = d
 	v.app.AddDevice(cntx, d.ID, d.SerialNum, config.SouthBoundID)
@@ -123,7 +122,7 @@
 	logger.Warnw(ctx, "Deleted device", log.Fields{"Device": id})
 }
 
-//AddControllerTask - add task to controller queue
+// AddControllerTask - add task to controller queue
 func (v *VoltController) AddControllerTask(device string, task tasks.Task) {
 	var taskQueueIntf interface{}
 	var taskQueue *tasks.Tasks
@@ -138,8 +137,8 @@
 	logger.Warnw(ctx, "Task Added to Controller Task List", log.Fields{"Len": taskQueue.NumPendingTasks(), "Total": taskQueue.TotalTasks()})
 }
 
-//AddNewDevice - called when new device is discovered. This will be
-//processed as part of controller queue
+// AddNewDevice - called when new device is discovered. This will be
+// processed as part of controller queue
 func (v *VoltController) AddNewDevice(config *intf.VPClientCfg) {
 	adt := NewAddDeviceTask(config)
 	v.AddControllerTask(config.DeviceID, adt)
@@ -210,12 +209,12 @@
 	v.app.DeviceDisableInd(cntx, dID)
 }
 
-//TriggerPendingProfileDeleteReq - trigger pending profile delete requests
+// TriggerPendingProfileDeleteReq - trigger pending profile delete requests
 func (v *VoltController) TriggerPendingProfileDeleteReq(cntx context.Context, device string) {
 	v.app.TriggerPendingProfileDeleteReq(cntx, device)
 }
 
-//TriggerPendingMigrateServicesReq - trigger pending services migration requests
+// TriggerPendingMigrateServicesReq - trigger pending services migration requests
 func (v *VoltController) TriggerPendingMigrateServicesReq(cntx context.Context, device string) {
 	v.app.TriggerPendingMigrateServicesReq(cntx, device)
 }
@@ -232,7 +231,7 @@
 	device.auditInProgress = false
 }
 
-//ProcessFlowModResultIndication - send flow mod result notification
+// ProcessFlowModResultIndication - send flow mod result notification
 func (v *VoltController) ProcessFlowModResultIndication(cntx context.Context, flowStatus intf.FlowStatus) {
 	v.app.ProcessFlowModResultIndication(cntx, flowStatus)
 }
@@ -275,7 +274,7 @@
 		return errorCodes.ErrPortNotFound
 	}
 	if d.ctx == nil {
-		//FIXME: Application should know the context before it could submit task. Handle at application level
+		// FIXME: Application should know the context before it could submit task. Handle at application level
 		logger.Errorw(ctx, "Context is missing. AddFlow Operation Not added to Task", log.Fields{"Device": device})
 		return errorCodes.ErrInvalidParamInRequest
 	}
@@ -326,7 +325,7 @@
 		return errorCodes.ErrPortNotFound
 	}
 	if d.ctx == nil {
-		//FIXME: Application should know the context before it could submit task. Handle at application level
+		// FIXME: Application should know the context before it could submit task. Handle at application level
 		logger.Errorw(ctx, "Context is missing. DelFlow Operation Not added to Task", log.Fields{"Device": device})
 		return errorCodes.ErrInvalidParamInRequest
 	}
@@ -376,7 +375,7 @@
 	}
 
 	if d.ctx == nil {
-		//FIXME: Application should know the context before it could submit task. Handle at application level
+		// FIXME: Application should know the context before it could submit task. Handle at application level
 		logger.Errorw(ctx, "Context is missing. GroupMod Operation Not added to task", log.Fields{"Device": device})
 		return errorCodes.ErrInvalidParamInRequest
 	}
@@ -507,7 +506,6 @@
 		return []tasks.Task{}
 	}
 	return d.GetTaskList()
-
 }
 
 // AddBlockedDevices to add devices to blocked devices list
@@ -617,7 +615,6 @@
 }
 
 func (v *VoltController) GetGroups(cntx context.Context, id uint32) (*of.Group, error) {
-
 	logger.Info(ctx, "Entering into GetGroupList method")
 	var groups *of.Group
 	for _, device := range v.devices {
diff --git a/internal/pkg/controller/controllertasks.go b/internal/pkg/controller/controllertasks.go
index 586999c..ddffac2 100644
--- a/internal/pkg/controller/controllertasks.go
+++ b/internal/pkg/controller/controllertasks.go
@@ -27,10 +27,10 @@
 
 // AddDeviceTask structure
 type AddDeviceTask struct {
-	taskID    uint8
 	ctx       context.Context
 	config    *intf.VPClientCfg
 	timestamp string
+	taskID    uint8
 }
 
 // NewAddDeviceTask is the constructor for AddDeviceTask
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index a3527c8..3ac5600 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -20,20 +20,22 @@
 	"encoding/json"
 	"errors"
 	"fmt"
-	infraerror "voltha-go-controller/internal/pkg/errorcodes"
 	"strconv"
 	"strings"
 	"sync"
 	"time"
+	infraerror "voltha-go-controller/internal/pkg/errorcodes"
 
 	"voltha-go-controller/database"
 	"voltha-go-controller/internal/pkg/holder"
 	"voltha-go-controller/internal/pkg/intf"
 	"voltha-go-controller/internal/pkg/of"
+
 	//"voltha-go-controller/internal/pkg/vpagent"
 	"voltha-go-controller/internal/pkg/tasks"
 	"voltha-go-controller/internal/pkg/util"
 	"voltha-go-controller/log"
+
 	ofp "github.com/opencord/voltha-protos/v5/go/openflow_13"
 	"github.com/opencord/voltha-protos/v5/go/voltha"
 )
@@ -54,14 +56,14 @@
 
 // DevicePort structure
 type DevicePort struct {
+	Name    string
+	State   PortState
+	Version string
+	HwAddr  string
 	tasks.Tasks
-	Name      string
-	ID        uint32
-	State     PortState
-	Version   string
-	HwAddr    string
 	CurrSpeed uint32
 	MaxSpeed  uint32
+	ID        uint32
 }
 
 // NewDevicePort is the constructor for DevicePort
@@ -115,32 +117,32 @@
 
 // Device structure
 type Device struct {
+	ctx              context.Context
+	cancel           context.CancelFunc
+	vclientHolder    *holder.VolthaServiceClientHolder
+	packetOutChannel chan *ofp.PacketOut
+	PortsByName      map[string]*DevicePort
+	flows            map[uint64]*of.VoltSubFlow
+	PortsByID        map[uint32]*DevicePort
+	meters           map[uint32]*of.Meter
+	flowQueue        map[uint32]*UniIDFlowQueue // key is hash ID generated and value is UniIDFlowQueue.
+	SouthBoundID     string
+	MfrDesc          string
+	HwDesc           string
+	SwDesc           string
+	ID               string
+	SerialNum        string
+	State            DeviceState
+	TimeStamp        time.Time
+	groups           sync.Map //map[uint32]*of.Group -> [GroupId : Group]
 	tasks.Tasks
-	ID                    string
-	SerialNum             string
-	State                 DeviceState
-	PortsByID             map[uint32]*DevicePort
-	PortsByName           map[string]*DevicePort
 	portLock              sync.RWMutex
-	vclientHolder         *holder.VolthaServiceClientHolder
-	ctx                   context.Context
-	cancel                context.CancelFunc
-	packetOutChannel      chan *ofp.PacketOut
-	flows                 map[uint64]*of.VoltSubFlow
 	flowLock              sync.RWMutex
-	meters                map[uint32]*of.Meter
 	meterLock             sync.RWMutex
-	groups                sync.Map //map[uint32]*of.Group -> [GroupId : Group]
-	auditInProgress       bool
 	flowQueueLock         sync.RWMutex
 	flowHash              uint32
-	flowQueue             map[uint32]*UniIDFlowQueue // key is hash ID generated and value is UniIDFlowQueue.
+	auditInProgress       bool
 	deviceAuditInProgress bool
-	SouthBoundID          string
-	MfrDesc               string
-	HwDesc                string
-	SwDesc                string
-	TimeStamp             time.Time
 }
 
 // NewDevice is the constructor for Device
@@ -155,7 +157,7 @@
 	device.flows = make(map[uint64]*of.VoltSubFlow)
 	device.meters = make(map[uint32]*of.Meter)
 	device.flowQueue = make(map[uint32]*UniIDFlowQueue)
-	//Get the flowhash from db and update the flowhash variable in the device.
+	// Get the flowhash from db and update the flowhash variable in the device.
 	device.SouthBoundID = southBoundID
 	device.MfrDesc = mfr
 	device.HwDesc = hwDesc
@@ -195,7 +197,7 @@
 }
 
 // GetAllFlows - Get the flow from device obj
-func (d *Device) GetAllFlows() ([]*of.VoltSubFlow) {
+func (d *Device) GetAllFlows() []*of.VoltSubFlow {
 	d.flowLock.RLock()
 	defer d.flowLock.RUnlock()
 	var flows []*of.VoltSubFlow
@@ -207,7 +209,7 @@
 }
 
 // GetAllPendingFlows - Get the flow from device obj
-func (d *Device) GetAllPendingFlows() ([]*of.VoltSubFlow) {
+func (d *Device) GetAllPendingFlows() []*of.VoltSubFlow {
 	d.flowLock.RLock()
 	defer d.flowLock.RUnlock()
 	var flows []*of.VoltSubFlow
@@ -322,7 +324,6 @@
 
 // UpdateGroupEntry - Adds/Updates the group to the device and also to the database
 func (d *Device) UpdateGroupEntry(cntx context.Context, group *of.Group) {
-
 	logger.Infow(ctx, "Update Group to device", log.Fields{"ID": group.GroupID})
 	d.groups.Store(group.GroupID, group)
 	d.AddGroupToDb(cntx, group)
@@ -340,7 +341,6 @@
 
 // DelGroupEntry - Deletes the group from the device and the database
 func (d *Device) DelGroupEntry(cntx context.Context, group *of.Group) {
-
 	if _, ok := d.groups.Load(group.GroupID); ok {
 		d.groups.Delete(group.GroupID)
 		d.DelGroupFromDb(cntx, group.GroupID)
@@ -352,7 +352,7 @@
 	_ = db.DelGroup(cntx, d.ID, groupID)
 }
 
-//RestoreGroupsFromDb - restores all groups from DB
+// RestoreGroupsFromDb - restores all groups from DB
 func (d *Device) RestoreGroupsFromDb(cntx context.Context) {
 	logger.Info(ctx, "Restoring Groups")
 	groups, _ := db.GetGroups(cntx, d.ID)
@@ -366,7 +366,7 @@
 	}
 }
 
-//CreateGroupFromString - Forms group struct from json string
+// CreateGroupFromString - Forms group struct from json string
 func (d *Device) CreateGroupFromString(b []byte) {
 	var group of.Group
 	if err := json.Unmarshal(b, &group); err == nil {
@@ -395,15 +395,15 @@
 
 // UpdateMeter to update meter
 func (d *Device) UpdateMeter(cntx context.Context, meter *of.Meter) error {
-       d.meterLock.Lock()
-       defer d.meterLock.Unlock()
-       if _, ok := d.meters[meter.ID]; ok {
-               d.meters[meter.ID] = meter
-               d.AddMeterToDb(cntx, meter)
-       } else {
-               return errors.New("Meter not found for updation")
-       }
-       return nil
+	d.meterLock.Lock()
+	defer d.meterLock.Unlock()
+	if _, ok := d.meters[meter.ID]; ok {
+		d.meters[meter.ID] = meter
+		d.AddMeterToDb(cntx, meter)
+	} else {
+		return errors.New("Meter not found for updation")
+	}
+	return nil
 }
 
 // GetMeter to get meter
@@ -501,7 +501,6 @@
 // DelPort to delete the port as requested by the device/VOLTHA
 // Inform the application if the port is successfully deleted
 func (d *Device) DelPort(cntx context.Context, id uint32) error {
-
 	p := d.GetPortByID(id)
 	if p == nil {
 		return errors.New("Unknown Port")
@@ -594,7 +593,6 @@
 		return p.ID, nil
 	}
 	return 0, errors.New("Unknown Port ID")
-
 }
 
 // WritePortToDb to add the port to the database
@@ -681,13 +679,12 @@
 }
 
 func (d *Device) synchronizeDeviceTables() {
-
 	tick := time.NewTicker(GetController().GetDeviceTableSyncDuration())
 loop:
 	for {
 		select {
 		case <-d.ctx.Done():
-			logger.Warnw(d.ctx, "Context Done. Cancelling Periodic Audit", log.Fields{"Context": ctx, "Device": d.ID, "DeviceSerialNum": d.SerialNum})
+			logger.Warnw(d.ctx, "Context Done. Canceling Periodic Audit", log.Fields{"Context": ctx, "Device": d.ID, "DeviceSerialNum": d.SerialNum})
 			break loop
 		case <-tick.C:
 			t1 := NewAuditTablesTask(d)
@@ -748,7 +745,7 @@
 	GetController().DeviceDisableInd(cntx, d.ID)
 }
 
-//ReSetAllPortStates - Set all logical device port status to DOWN
+// ReSetAllPortStates - Set all logical device port status to DOWN
 func (d *Device) ReSetAllPortStates(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN", log.Fields{"Device": d.ID, "State": d.State})
 
@@ -765,7 +762,7 @@
 	}
 }
 
-//ReSetAllPortStatesInDb - Set all logical device port status to DOWN in DB and skip indication to application
+// ReSetAllPortStatesInDb - Set all logical device port status to DOWN in DB and skip indication to application
 func (d *Device) ReSetAllPortStatesInDb(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN In DB", log.Fields{"Device": d.ID, "State": d.State})
 
@@ -990,7 +987,7 @@
 
 func (d *Device) getAndAddFlowQueueForUniID(id uint32) *UniIDFlowQueue {
 	d.flowQueueLock.RLock()
-	//If flowhash is 0 that means flowhash throttling is disabled, return nil
+	// If flowhash is 0 that means flowhash throttling is disabled, return nil
 	if d.flowHash == 0 {
 		d.flowQueueLock.RUnlock()
 		return nil
@@ -1007,7 +1004,6 @@
 }
 
 func (d *Device) addFlowQueueForUniID(id uint32) *UniIDFlowQueue {
-
 	d.flowQueueLock.Lock()
 	defer d.flowQueueLock.Unlock()
 	flowHashID := id % uint32(d.flowHash)
@@ -1037,9 +1033,8 @@
 	}
 }
 
-//isSBOperAllowed - determins if the SB operation is allowed based on device state & force flag
+// isSBOperAllowed - determines if the SB operation is allowed based on device state & force flag
 func (d *Device) isSBOperAllowed(forceAction bool) bool {
-
 	if d.State == DeviceStateUP {
 		return true
 	}
@@ -1057,7 +1052,6 @@
 }
 
 func (d *Device) triggerFlowResultNotification(cntx context.Context, cookie uint64, flow *of.VoltSubFlow, oper of.Command, bwDetails of.BwAvailDetails, err error) {
-
 	statusCode, statusMsg := infraerror.GetErrorInfo(err)
 	success := isFlowOperSuccess(statusCode, oper)
 
@@ -1069,7 +1063,7 @@
 		}
 	}
 
-	//Update flow results
+	// Update flow results
 	// Add - Update Success or Failure status with reason
 	// Del - Delete entry from DB on success else update error reason
 	if oper == of.CommandAdd {
diff --git a/internal/pkg/controller/modgroup.go b/internal/pkg/controller/modgroup.go
index 065c161..9fdb478 100644
--- a/internal/pkg/controller/modgroup.go
+++ b/internal/pkg/controller/modgroup.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -24,19 +24,20 @@
 
 	"voltha-go-controller/internal/pkg/of"
 	"voltha-go-controller/log"
+
 	"google.golang.org/grpc/codes"
 )
 
-//ModGroupTask - Group Modification Task
+// ModGroupTask - Group Modification Task
 type ModGroupTask struct {
-	taskID    uint8
 	ctx       context.Context
 	group     *of.Group
 	device    *Device
 	timestamp string
+	taskID    uint8
 }
 
-//NewModGroupTask - Initializes new group task
+// NewModGroupTask - Initializes new group task
 func NewModGroupTask(ctx context.Context, group *of.Group, device *Device) *ModGroupTask {
 	var grp ModGroupTask
 	grp.device = device
@@ -47,12 +48,12 @@
 	return &grp
 }
 
-//Name - Name of task
+// Name - Name of task
 func (grp *ModGroupTask) Name() string {
 	return "Group Mod Task"
 }
 
-//TaskID - Task id
+// TaskID - Task id
 func (grp *ModGroupTask) TaskID() uint8 {
 	return grp.taskID
 }
@@ -62,11 +63,11 @@
 	return grp.timestamp
 }
 
-//Stop - task stop
+// Stop - task stop
 func (grp *ModGroupTask) Stop() {
 }
 
-//Start - task start
+// Start - task start
 func (grp *ModGroupTask) Start(ctx context.Context, taskID uint8) error {
 	var err error
 	grp.taskID = taskID
@@ -74,11 +75,9 @@
 	i := 0
 
 	processGroupModResult := func(err error) bool {
-
 		statusCode, statusMsg := infraerror.GetErrorInfo(err)
 
 		if infraerrorcode.ErrorCode(statusCode) != infraerrorcode.ErrOk {
-
 			if grp.group.Command == of.GroupCommandAdd && (codes.Code(statusCode) == codes.AlreadyExists) {
 				logger.Warnw(ctx, "Update Group Table Failed - Ignoring since Group Already exists",
 					log.Fields{"groupId": grp.group.GroupID, "groupOp": grp.group.Command, "Status": statusCode, "errorReason": statusMsg})
@@ -90,7 +89,6 @@
 		}
 		logger.Infow(ctx, "Group Mod Result", log.Fields{"groupID": grp.group.GroupID, "Error Code": statusCode})
 		return true
-
 	}
 
 	if grp.group.Command != of.GroupCommandDel {
@@ -107,10 +105,9 @@
 
 	groupUpdate := of.CreateGroupTableUpdate(grp.group)
 	if vc := grp.device.VolthaClient(); vc != nil {
-
-		//Retry on group mod failure
-		//Retry attempts = 3
-		//Delay between retry = 100ms. Total Possible Delay = 200ms
+		// Retry on group mod failure
+		// Retry attempts = 3
+		// Delay between retry = 100ms. Total Possible Delay = 200ms
 		for {
 			logger.Infow(ctx, "Group Mod Triggered", log.Fields{"GroupId": grp.group.GroupID, "Attempt": i})
 			_, err = vc.UpdateLogicalDeviceFlowGroupTable(grp.ctx, groupUpdate)
@@ -124,7 +121,6 @@
 			}
 			logger.Errorw(ctx, "Update Group Table Failed on all 3 attempts. Dropping request", log.Fields{"GroupId": grp.group.GroupID, "Bucket": grp.group.Buckets})
 			break
-
 		}
 		return err
 	}
diff --git a/internal/pkg/controller/modmeter.go b/internal/pkg/controller/modmeter.go
index acbef44..6b677a9 100644
--- a/internal/pkg/controller/modmeter.go
+++ b/internal/pkg/controller/modmeter.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -25,12 +25,12 @@
 
 // ModMeterTask structure
 type ModMeterTask struct {
-	taskID    uint8
 	ctx       context.Context
-	command   of.MeterCommand
 	meter     *of.Meter
 	device    *Device
 	timestamp string
+	command   of.MeterCommand
+	taskID    uint8
 }
 
 // NewModMeterTask is the constructor for ModMeterTask
@@ -69,7 +69,7 @@
 	mmt.taskID = taskID
 	mmt.ctx = ctx
 
-	//Temp commenting Sync response handling
+	// Temp commenting Sync response handling
 	//triggerMeterNotification := func(err error) {
 
 	// 	statusCode, statusMsg := infraerror.GetErrorInfo(err)
@@ -112,12 +112,11 @@
 	}
 
 	if vc := mmt.device.VolthaClient(); vc != nil {
-
 		if _, err = vc.UpdateLogicalDeviceMeterTable(mmt.ctx, meterMod); err != nil {
 			logger.Errorw(ctx, "Update Meter Table Failed", log.Fields{"Reason": err.Error()})
 		} else {
 			mmt.meter.State = of.MeterOperSuccess
-			if err := mmt.device.UpdateMeter(ctx, mmt.meter); err != nil {
+			if err = mmt.device.UpdateMeter(ctx, mmt.meter); err != nil {
 				// Meter does not exist, update failed
 				logger.Error(ctx, "Update meter to DB failed")
 			}
diff --git a/internal/pkg/controller/pendingprofiles.go b/internal/pkg/controller/pendingprofiles.go
index 97bb238..c972e9f 100644
--- a/internal/pkg/controller/pendingprofiles.go
+++ b/internal/pkg/controller/pendingprofiles.go
@@ -11,7 +11,7 @@
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-*/
+ */
 
 package controller
 
@@ -24,10 +24,10 @@
 
 // PendingProfilesTask structure
 type PendingProfilesTask struct {
-	taskID uint8
 	ctx    context.Context
 	device *Device
 	ts     string
+	taskID uint8
 }
 
 // NewPendingProfilesTask is constructor for PendingProfilesTask
diff --git a/internal/pkg/controller/utils.go b/internal/pkg/controller/utils.go
index c07ac59..179730e 100644
--- a/internal/pkg/controller/utils.go
+++ b/internal/pkg/controller/utils.go
@@ -51,13 +51,9 @@
 		loxiOutputAction := action.(*ofp.ActionOutput)
 		var output openflow_13.OfpActionOutput
 		output.Port = uint32(loxiOutputAction.GetPort())
-		/*
 			var maxLen uint16
 			maxLen = loxiOutputAction.GetMaxLen()
 			output.MaxLen = uint32(maxLen)
-
-		*/
-/*
 		output.MaxLen = 0
 		outputAction.Output = &output
 		ofpAction.Action = &outputAction