Fixing golang linters for VGC
Change-Id: I386d232c74ab47e24d92c18800dc144120b920da
diff --git a/internal/pkg/application/igmpport.go b/internal/pkg/application/igmpport.go
index b22b901..171fca0 100644
--- a/internal/pkg/application/igmpport.go
+++ b/internal/pkg/application/igmpport.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 application
@@ -21,7 +21,7 @@
"net"
"voltha-go-controller/internal/pkg/of"
- "voltha-go-controller/log"
+ "voltha-go-controller/log"
)
// IgmpGroupPort : IGMP port implements a port which is associated with an IGMP
@@ -32,92 +32,92 @@
// lists. If we receive a include list we should purge the other
// list which is TODO
type IgmpGroupPort struct {
- Port string
- CVlan uint16
- Pbit uint8
- Version uint8
- Exclude bool
- ExcludeList []net.IP
- IncludeList []net.IP
- QueryTimeoutCount uint32
- PonPortID uint32
+ Port string
+ ExcludeList []net.IP
+ IncludeList []net.IP
+ QueryTimeoutCount uint32
+ PonPortID uint32
+ CVlan uint16
+ Pbit uint8
+ Version uint8
+ Exclude bool
}
// NewIgmpGroupPort is constructor for a port
func NewIgmpGroupPort(port string, cvlan uint16, pbit uint8, version uint8, incl bool, ponPortID uint32) *IgmpGroupPort {
- var igp IgmpGroupPort
- igp.Port = port
- igp.CVlan = cvlan
- igp.Pbit = pbit
- igp.Version = version
- igp.Exclude = !incl
- igp.QueryTimeoutCount = 0
- igp.PonPortID = ponPortID
- return &igp
+ var igp IgmpGroupPort
+ igp.Port = port
+ igp.CVlan = cvlan
+ igp.Pbit = pbit
+ igp.Version = version
+ igp.Exclude = !incl
+ igp.QueryTimeoutCount = 0
+ igp.PonPortID = ponPortID
+ return &igp
}
// InclSourceIsIn checks if a source is in include list
func (igp *IgmpGroupPort) InclSourceIsIn(src net.IP) bool {
- return IsIPPresent(src, igp.IncludeList)
+ return IsIPPresent(src, igp.IncludeList)
}
// ExclSourceIsIn checks if a source is in exclude list
func (igp *IgmpGroupPort) ExclSourceIsIn(src net.IP) bool {
- return IsIPPresent(src, igp.ExcludeList)
+ return IsIPPresent(src, igp.ExcludeList)
}
// AddInclSource adds a source is in include list
func (igp *IgmpGroupPort) AddInclSource(src net.IP) {
- logger.Debugw(ctx, "Adding Include Source", log.Fields{"Port": igp.Port, "Src": src})
- igp.IncludeList = append(igp.IncludeList, src)
+ logger.Debugw(ctx, "Adding Include Source", log.Fields{"Port": igp.Port, "Src": src})
+ igp.IncludeList = append(igp.IncludeList, src)
}
// AddExclSource adds a source is in exclude list
func (igp *IgmpGroupPort) AddExclSource(src net.IP) {
- logger.Debugw(ctx, "Adding Exclude Source", log.Fields{"Port": igp.Port, "Src": src})
- igp.ExcludeList = append(igp.ExcludeList, src)
+ logger.Debugw(ctx, "Adding Exclude Source", log.Fields{"Port": igp.Port, "Src": src})
+ igp.ExcludeList = append(igp.ExcludeList, src)
}
// DelInclSource deletes a source is in include list
func (igp *IgmpGroupPort) DelInclSource(src net.IP) {
- logger.Debugw(ctx, "Deleting Include Source", log.Fields{"Port": igp.Port, "Src": src})
- for i, addr := range igp.IncludeList {
- if addr.Equal(src) {
- igp.IncludeList = append(igp.IncludeList[:i], igp.IncludeList[i+1:]...)
- return
- }
- }
+ logger.Debugw(ctx, "Deleting Include Source", log.Fields{"Port": igp.Port, "Src": src})
+ for i, addr := range igp.IncludeList {
+ if addr.Equal(src) {
+ igp.IncludeList = append(igp.IncludeList[:i], igp.IncludeList[i+1:]...)
+ return
+ }
+ }
}
// DelExclSource deletes a source is in exclude list
func (igp *IgmpGroupPort) DelExclSource(src net.IP) {
- logger.Debugw(ctx, "Deleting Exclude Source", log.Fields{"Port": igp.Port, "Src": src})
- for i, addr := range igp.ExcludeList {
- if addr.Equal(src) {
- igp.ExcludeList = append(igp.ExcludeList[:i], igp.ExcludeList[i+1:]...)
- return
- }
- }
+ logger.Debugw(ctx, "Deleting Exclude Source", log.Fields{"Port": igp.Port, "Src": src})
+ for i, addr := range igp.ExcludeList {
+ if addr.Equal(src) {
+ igp.ExcludeList = append(igp.ExcludeList[:i], igp.ExcludeList[i+1:]...)
+ return
+ }
+ }
}
// WriteToDb is utility to write IGMP Group Port Info to database
func (igp *IgmpGroupPort) WriteToDb(cntx context.Context, mvlan of.VlanType, gip net.IP, device string) error {
- b, err := json.Marshal(igp)
- if err != nil {
- return err
- }
- if err1 := db.PutIgmpRcvr(cntx, mvlan, gip, device, igp.Port, string(b)); err1 != nil {
- return err1
- }
- return nil
+ b, err := json.Marshal(igp)
+ if err != nil {
+ return err
+ }
+ if err1 := db.PutIgmpRcvr(cntx, mvlan, gip, device, igp.Port, string(b)); err1 != nil {
+ return err1
+ }
+ return nil
}
// NewIgmpGroupPortFromBytes create the IGMP group port from a byte slice
func NewIgmpGroupPortFromBytes(b []byte) (*IgmpGroupPort, error) {
- var igp IgmpGroupPort
- if err := json.Unmarshal(b, &igp); err != nil {
- logger.Warnw(ctx, "Decode of port failed", log.Fields{"str": string(b)})
- return nil, err
- }
- return &igp, nil
+ var igp IgmpGroupPort
+ if err := json.Unmarshal(b, &igp); err != nil {
+ logger.Warnw(ctx, "Decode of port failed", log.Fields{"str": string(b)})
+ return nil, err
+ }
+ return &igp, nil
}