Skip to content

Commit

Permalink
fix(linting): special linting fix for v1.5 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aauren committed Oct 19, 2022
1 parent 62b15c6 commit fb5905e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions pkg/controllers/routing/ecmp_vip.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"strings"

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/any"
gobgpapi "github.com/osrg/gobgp/api"
Expand All @@ -26,16 +26,16 @@ func (nrc *NetworkRoutingController) bgpAdvertiseVIP(vip string) error {
klog.V(2).Infof("Advertising route: '%s/%s via %s' to peers",
vip, strconv.Itoa(32), nrc.nodeIP.String())

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a1, _ := ptypes.MarshalAny(&gobgpapi.OriginAttribute{
Origin: 0,
})
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a2, _ := ptypes.MarshalAny(&gobgpapi.NextHopAttribute{
NextHop: nrc.nodeIP.String(),
})
attrs := []*any.Any{a1, a2}
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
nlri1, _ := ptypes.MarshalAny(&gobgpapi.IPAddressPrefix{
Prefix: vip,
PrefixLen: 32,
Expand All @@ -56,16 +56,16 @@ func (nrc *NetworkRoutingController) bgpWithdrawVIP(vip string) error {
klog.V(2).Infof("Withdrawing route: '%s/%s via %s' to peers",
vip, strconv.Itoa(32), nrc.nodeIP.String())

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a1, _ := ptypes.MarshalAny(&gobgpapi.OriginAttribute{
Origin: 0,
})
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a2, _ := ptypes.MarshalAny(&gobgpapi.NextHopAttribute{
NextHop: nrc.nodeIP.String(),
})
attrs := []*any.Any{a1, a2}
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
nlri, _ := ptypes.MarshalAny(&gobgpapi.IPAddressPrefix{
Prefix: vip,
PrefixLen: 32,
Expand Down
14 changes: 7 additions & 7 deletions pkg/controllers/routing/network_routes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/coreos/go-iptables/iptables"
"github.com/golang/protobuf/ptypes/any"

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
"github.com/golang/protobuf/ptypes"
gobgpapi "github.com/osrg/gobgp/api"
gobgp "github.com/osrg/gobgp/pkg/server"
Expand Down Expand Up @@ -482,16 +482,16 @@ func (nrc *NetworkRoutingController) advertisePodRoute() error {
Afi: gobgpapi.Family_AFI_IP6,
Safi: gobgpapi.Family_SAFI_UNICAST,
}
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
nlri, _ := ptypes.MarshalAny(&gobgpapi.IPAddressPrefix{
PrefixLen: uint32(cidrLen),
Prefix: cidrStr[0],
})
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a1, _ := ptypes.MarshalAny(&gobgpapi.OriginAttribute{
Origin: 0,
})
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
v6Attrs, _ := ptypes.MarshalAny(&gobgpapi.MpReachNLRIAttribute{
Family: v6Family,
NextHops: []string{nrc.nodeIP.String()},
Expand All @@ -510,17 +510,17 @@ func (nrc *NetworkRoutingController) advertisePodRoute() error {
} else {

klog.V(2).Infof("Advertising route: '%s/%d via %s' to peers", subnet, cidrLen, nrc.nodeIP.String())
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
nlri, _ := ptypes.MarshalAny(&gobgpapi.IPAddressPrefix{
PrefixLen: uint32(cidrLen),
Prefix: cidrStr[0],
})

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a1, _ := ptypes.MarshalAny(&gobgpapi.OriginAttribute{
Origin: 0,
})
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
a2, _ := ptypes.MarshalAny(&gobgpapi.NextHopAttribute{
NextHop: nrc.nodeIP.String(),
})
Expand Down
12 changes: 6 additions & 6 deletions pkg/controllers/routing/network_routes_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/tools/cache"

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
"github.com/golang/protobuf/ptypes"
gobgpapi "github.com/osrg/gobgp/api"
gobgp "github.com/osrg/gobgp/pkg/server"
Expand Down Expand Up @@ -231,7 +231,7 @@ func Test_advertiseClusterIPs(t *testing.T) {
for _, path := range events {
nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err := ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
t.Fatalf("Invalid nlri in advertised path")
Expand Down Expand Up @@ -585,7 +585,7 @@ func Test_advertiseExternalIPs(t *testing.T) {
for _, path := range events {
nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err := ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
t.Fatalf("Invalid nlri in advertised path")
Expand Down Expand Up @@ -777,7 +777,7 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
for _, path := range events {
nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err := ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
t.Fatalf("Invalid nlri in advertised path")
Expand Down Expand Up @@ -1002,7 +1002,7 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
for _, path := range events {
nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err := ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
t.Fatalf("Invalid nlri in advertised path")
Expand Down Expand Up @@ -1298,7 +1298,7 @@ func Test_advertisePodRoute(t *testing.T) {
for _, path := range events {
nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err := ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
t.Fatalf("Invalid nlri in advertised path")
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/routing/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"
"strings"

// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
"github.com/golang/protobuf/ptypes"
gobgpapi "github.com/osrg/gobgp/api"
"github.com/osrg/gobgp/pkg/packet/bgp"
Expand Down Expand Up @@ -177,9 +177,9 @@ func validateCommunity(arg string) error {
// can't parse a next hop IP from the GoBGP Path, it returns an error.
func parseBGPNextHop(path *gobgpapi.Path) (net.IP, error) {
for _, pAttr := range path.GetPattrs() {
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
var value ptypes.DynamicAny
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
if err := ptypes.UnmarshalAny(pAttr, &value); err != nil {
return nil, fmt.Errorf("failed to unmarshal path attribute: %s", err)
}
Expand Down Expand Up @@ -209,7 +209,7 @@ func parseBGPPath(path *gobgpapi.Path) (*net.IPNet, net.IP, error) {

nlri := path.GetNlri()
var prefix gobgpapi.IPAddressPrefix
// nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
//nolint:staticcheck // this has to stick around for now until gobgp updates protobuf
err = ptypes.UnmarshalAny(nlri, &prefix)
if err != nil {
return nil, nil, fmt.Errorf("invalid nlri in advertised path")
Expand Down

0 comments on commit fb5905e

Please sign in to comment.