diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-05-22 16:57:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-05-23 14:34:55 +0900 |
commit | 46b6fc2ccd02404f6fa3c5a4ea71fd192ee867ba (patch) | |
tree | 56c017707a9a63eebb1ef806605ca1e9a90ed706 /packet | |
parent | b37d9bb56a30ee390732a530ea8e9cb174db1759 (diff) |
bmp: Remove redundant error value declaration
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'packet')
-rw-r--r-- | packet/bmp/bmp.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/packet/bmp/bmp.go b/packet/bmp/bmp.go index 3cdccf46..ba517bda 100644 --- a/packet/bmp/bmp.go +++ b/packet/bmp/bmp.go @@ -338,18 +338,15 @@ func (body *BMPStatisticsReport) ParseBody(msg *BMPMessage, data []byte) error { return fmt.Errorf("value lengh is not enough: %d bytes (%d bytes expected)", len(data), tl.Length) } var s BMPStatsTLVInterface - var err error = nil - if tl.Type == BMP_STAT_TYPE_ADJ_RIB_IN || tl.Type == BMP_STAT_TYPE_LOC_RIB { + switch tl.Type { + case BMP_STAT_TYPE_ADJ_RIB_IN, BMP_STAT_TYPE_LOC_RIB: s = &BMPStatsTLV64{BMPStatsTLV: tl} - err = s.ParseValue(data) - } else if tl.Type == BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_IN || tl.Type == BMP_STAT_TYPE_PER_AFI_SAFI_LOC_RIB { + case BMP_STAT_TYPE_PER_AFI_SAFI_ADJ_RIB_IN, BMP_STAT_TYPE_PER_AFI_SAFI_LOC_RIB: s = &BMPStatsTLVPerAfiSafi64{BMPStatsTLV: tl} - err = s.ParseValue(data) - } else { + default: s = &BMPStatsTLV32{BMPStatsTLV: tl} - err = s.ParseValue(data) } - if err != nil { + if err := s.ParseValue(data); err != nil { return err } body.Stats = append(body.Stats, s) |