diff options
author | Dmitri Nikulin <dnikulin@gmail.com> | 2020-04-23 12:50:33 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2020-06-24 07:32:48 +0900 |
commit | 210696d6ff912ef8aa7fe0553b5b8ecfbc4bc7b1 (patch) | |
tree | 7a4f91981119f2a577aca2db4e7e09ea88a2140a /pkg | |
parent | 33e3bb6b27561c49164d1670d7c88bd33d83ef37 (diff) |
Regenerate stringer code for public enum types.
This adds support for several values which were added to enums without
corresponding changes to the stringer generated code.
New versions of stringer, including the one used for this change, add
compile-time checks for whether any existing enum values have changed.
Adding new values does not violate this check.
Resolves https://github.com/osrg/gobgp/issues/2265
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/packet/bgp/bgpattrtype_string.go | 49 | ||||
-rw-r--r-- | pkg/packet/bgp/esitype_string.go | 20 | ||||
-rw-r--r-- | pkg/packet/bgp/fsmstate_string.go | 18 |
3 files changed, 77 insertions, 10 deletions
diff --git a/pkg/packet/bgp/bgpattrtype_string.go b/pkg/packet/bgp/bgpattrtype_string.go index 1a2cf1d0..3726b171 100644 --- a/pkg/packet/bgp/bgpattrtype_string.go +++ b/pkg/packet/bgp/bgpattrtype_string.go @@ -1,17 +1,50 @@ -// generated by stringer -type BGPAttrType bgp.go; DO NOT EDIT +// Code generated by "stringer -type=BGPAttrType"; DO NOT EDIT. package bgp -import "fmt" +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[BGP_ATTR_TYPE_ORIGIN-1] + _ = x[BGP_ATTR_TYPE_AS_PATH-2] + _ = x[BGP_ATTR_TYPE_NEXT_HOP-3] + _ = x[BGP_ATTR_TYPE_MULTI_EXIT_DISC-4] + _ = x[BGP_ATTR_TYPE_LOCAL_PREF-5] + _ = x[BGP_ATTR_TYPE_ATOMIC_AGGREGATE-6] + _ = x[BGP_ATTR_TYPE_AGGREGATOR-7] + _ = x[BGP_ATTR_TYPE_COMMUNITIES-8] + _ = x[BGP_ATTR_TYPE_ORIGINATOR_ID-9] + _ = x[BGP_ATTR_TYPE_CLUSTER_LIST-10] + _ = x[BGP_ATTR_TYPE_MP_REACH_NLRI-14] + _ = x[BGP_ATTR_TYPE_MP_UNREACH_NLRI-15] + _ = x[BGP_ATTR_TYPE_EXTENDED_COMMUNITIES-16] + _ = x[BGP_ATTR_TYPE_AS4_PATH-17] + _ = x[BGP_ATTR_TYPE_AS4_AGGREGATOR-18] + _ = x[BGP_ATTR_TYPE_PMSI_TUNNEL-22] + _ = x[BGP_ATTR_TYPE_TUNNEL_ENCAP-23] + _ = x[BGP_ATTR_TYPE_IP6_EXTENDED_COMMUNITIES-25] + _ = x[BGP_ATTR_TYPE_AIGP-26] + _ = x[BGP_ATTR_TYPE_LS-29] + _ = x[BGP_ATTR_TYPE_LARGE_COMMUNITY-32] +} const ( _BGPAttrType_name_0 = "BGP_ATTR_TYPE_ORIGINBGP_ATTR_TYPE_AS_PATHBGP_ATTR_TYPE_NEXT_HOPBGP_ATTR_TYPE_MULTI_EXIT_DISCBGP_ATTR_TYPE_LOCAL_PREFBGP_ATTR_TYPE_ATOMIC_AGGREGATEBGP_ATTR_TYPE_AGGREGATORBGP_ATTR_TYPE_COMMUNITIESBGP_ATTR_TYPE_ORIGINATOR_IDBGP_ATTR_TYPE_CLUSTER_LIST" _BGPAttrType_name_1 = "BGP_ATTR_TYPE_MP_REACH_NLRIBGP_ATTR_TYPE_MP_UNREACH_NLRIBGP_ATTR_TYPE_EXTENDED_COMMUNITIESBGP_ATTR_TYPE_AS4_PATHBGP_ATTR_TYPE_AS4_AGGREGATOR" + _BGPAttrType_name_2 = "BGP_ATTR_TYPE_PMSI_TUNNELBGP_ATTR_TYPE_TUNNEL_ENCAP" + _BGPAttrType_name_3 = "BGP_ATTR_TYPE_IP6_EXTENDED_COMMUNITIESBGP_ATTR_TYPE_AIGP" + _BGPAttrType_name_4 = "BGP_ATTR_TYPE_LS" + _BGPAttrType_name_5 = "BGP_ATTR_TYPE_LARGE_COMMUNITY" ) var ( _BGPAttrType_index_0 = [...]uint8{0, 20, 41, 63, 92, 116, 146, 170, 195, 222, 248} _BGPAttrType_index_1 = [...]uint8{0, 27, 56, 90, 112, 140} + _BGPAttrType_index_2 = [...]uint8{0, 25, 51} + _BGPAttrType_index_3 = [...]uint8{0, 38, 56} ) func (i BGPAttrType) String() string { @@ -22,7 +55,17 @@ func (i BGPAttrType) String() string { case 14 <= i && i <= 18: i -= 14 return _BGPAttrType_name_1[_BGPAttrType_index_1[i]:_BGPAttrType_index_1[i+1]] + case 22 <= i && i <= 23: + i -= 22 + return _BGPAttrType_name_2[_BGPAttrType_index_2[i]:_BGPAttrType_index_2[i+1]] + case 25 <= i && i <= 26: + i -= 25 + return _BGPAttrType_name_3[_BGPAttrType_index_3[i]:_BGPAttrType_index_3[i+1]] + case i == 29: + return _BGPAttrType_name_4 + case i == 32: + return _BGPAttrType_name_5 default: - return fmt.Sprintf("BGPAttrType(%d)", i) + return "BGPAttrType(" + strconv.FormatInt(int64(i), 10) + ")" } } diff --git a/pkg/packet/bgp/esitype_string.go b/pkg/packet/bgp/esitype_string.go index 5651bda8..f7aef8e3 100644 --- a/pkg/packet/bgp/esitype_string.go +++ b/pkg/packet/bgp/esitype_string.go @@ -1,16 +1,28 @@ -// generated by stringer -type=ESIType bgp.go validate.go; DO NOT EDIT +// Code generated by "stringer -type=ESIType"; DO NOT EDIT. package bgp -import "fmt" +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ESI_ARBITRARY-0] + _ = x[ESI_LACP-1] + _ = x[ESI_MSTP-2] + _ = x[ESI_MAC-3] + _ = x[ESI_ROUTERID-4] + _ = x[ESI_AS-5] +} const _ESIType_name = "ESI_ARBITRARYESI_LACPESI_MSTPESI_MACESI_ROUTERIDESI_AS" var _ESIType_index = [...]uint8{0, 13, 21, 29, 36, 48, 54} func (i ESIType) String() string { - if i+1 >= ESIType(len(_ESIType_index)) { - return fmt.Sprintf("ESIType(%d)", i) + if i >= ESIType(len(_ESIType_index)-1) { + return "ESIType(" + strconv.FormatInt(int64(i), 10) + ")" } return _ESIType_name[_ESIType_index[i]:_ESIType_index[i+1]] } diff --git a/pkg/packet/bgp/fsmstate_string.go b/pkg/packet/bgp/fsmstate_string.go index 4416afc1..74fe0cba 100644 --- a/pkg/packet/bgp/fsmstate_string.go +++ b/pkg/packet/bgp/fsmstate_string.go @@ -1,8 +1,20 @@ -// generated by stringer -type=FSMState -output=fsmstate_string.go bgp.go validate.go mrt.go rtr.go constant.go bmp.go esitype_string.go bgpattrtype_string.go; DO NOT EDIT +// Code generated by "stringer -type=FSMState"; DO NOT EDIT. package bgp -import "fmt" +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[BGP_FSM_IDLE-0] + _ = x[BGP_FSM_CONNECT-1] + _ = x[BGP_FSM_ACTIVE-2] + _ = x[BGP_FSM_OPENSENT-3] + _ = x[BGP_FSM_OPENCONFIRM-4] + _ = x[BGP_FSM_ESTABLISHED-5] +} const _FSMState_name = "BGP_FSM_IDLEBGP_FSM_CONNECTBGP_FSM_ACTIVEBGP_FSM_OPENSENTBGP_FSM_OPENCONFIRMBGP_FSM_ESTABLISHED" @@ -10,7 +22,7 @@ var _FSMState_index = [...]uint8{0, 12, 27, 41, 57, 76, 95} func (i FSMState) String() string { if i < 0 || i >= FSMState(len(_FSMState_index)-1) { - return fmt.Sprintf("FSMState(%d)", i) + return "FSMState(" + strconv.FormatInt(int64(i), 10) + ")" } return _FSMState_name[_FSMState_index[i]:_FSMState_index[i+1]] } |