diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-01-09 09:07:06 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-01-09 14:36:48 +0900 |
commit | 1d14b8ecfba61de524e0266e4a0fddb3b111f235 (patch) | |
tree | 8e66d6dada1377f85e58669c416f7f4cf993ee34 /internal/pkg/table/message.go | |
parent | 0ae389ad1e7daeaeb354cd4be76b13ece9153e00 (diff) |
silence staticcheck warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'internal/pkg/table/message.go')
-rw-r--r-- | internal/pkg/table/message.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/pkg/table/message.go b/internal/pkg/table/message.go index 31b90596..32069484 100644 --- a/internal/pkg/table/message.go +++ b/internal/pkg/table/message.go @@ -85,9 +85,9 @@ func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error { asAttrPos := 0 as4AttrPos := 0 for i, attr := range msg.PathAttributes { - switch attr.(type) { + switch a := attr.(type) { case *bgp.PathAttributeAsPath: - asAttr = attr.(*bgp.PathAttributeAsPath) + asAttr = a for j, param := range asAttr.Value { as2Param, ok := param.(*bgp.AsPathParam) if ok { @@ -103,7 +103,7 @@ func UpdatePathAttrs4ByteAs(msg *bgp.BGPUpdate) error { msg.PathAttributes[i] = asAttr case *bgp.PathAttributeAs4Path: as4AttrPos = i - as4Attr = attr.(*bgp.PathAttributeAs4Path) + as4Attr = a } } @@ -211,9 +211,8 @@ func UpdatePathAggregator2ByteAs(msg *bgp.BGPUpdate) { as := uint32(0) var addr string for i, attr := range msg.PathAttributes { - switch attr.(type) { + switch agg := attr.(type) { case *bgp.PathAttributeAggregator: - agg := attr.(*bgp.PathAttributeAggregator) addr = agg.Value.Address.String() if agg.Value.AS > (1<<16)-1 { as = agg.Value.AS @@ -233,15 +232,15 @@ func UpdatePathAggregator4ByteAs(msg *bgp.BGPUpdate) error { var agg4Attr *bgp.PathAttributeAs4Aggregator agg4AttrPos := 0 for i, attr := range msg.PathAttributes { - switch attr.(type) { + switch agg := attr.(type) { case *bgp.PathAttributeAggregator: - attr := attr.(*bgp.PathAttributeAggregator) + attr := agg if attr.Value.Askind == reflect.Uint16 { aggAttr = attr aggAttr.Value.Askind = reflect.Uint32 } case *bgp.PathAttributeAs4Aggregator: - agg4Attr = attr.(*bgp.PathAttributeAs4Aggregator) + agg4Attr = agg agg4AttrPos = i } } |