Skip to content

Commit

Permalink
Add //go:generate stringer directives for public enum types.
Browse files Browse the repository at this point in the history
All such directives can be invoked by running
$ go generate

Stringer itself can be obtained by running
$ go get golang.org/x/tools/cmd/stringer

See #2265
  • Loading branch information
dnikulin authored and fujita committed Jun 23, 2020
1 parent 210696d commit 8cadc75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/packet/bgp/bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,7 @@ func NewRouteTargetMembershipNLRI(as uint32, target ExtendedCommunityInterface)
}
}

//go:generate stringer -type=ESIType
type ESIType uint8

const (
Expand Down Expand Up @@ -8284,6 +8285,7 @@ func (f BGPAttrFlag) String() string {
return strings.Join(strs, "|")
}

//go:generate stringer -type=BGPAttrType
type BGPAttrType uint8

const (
Expand Down
1 change: 1 addition & 0 deletions pkg/packet/bgp/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const AS_TRANS = 23456

const BGP_PORT = 179

//go:generate stringer -type=FSMState
type FSMState int

const (
Expand Down

0 comments on commit 8cadc75

Please sign in to comment.