Create a gist now

Instantly share code, notes, and snippets.

@svett /main.go
Last active Sep 22, 2015

What would you like to do?
package main
import "fmt"
//go:generate stringer -type=MessageStatus
type MessageStatus int
const (
Sent MessageStatus = iota
Received
Rejected
)
func main() {
status := Sent
fmt.Printf("Message is %s", status)
}
// generated by stringer -type=MessageStatus; DO NOT EDIT
package main
import "fmt"
const _MessageStatus_name = "SentReceivedRejected"
var _MessageStatus_index = [...]uint8{0, 4, 12, 20}
func (i MessageStatus) String() string {
if i < 0 || i >= MessageStatus(len(_MessageStatus_index)-1) {
return fmt.Sprintf("MessageStatus(%d)", i)
}
return _MessageStatus_name[_MessageStatus_index[i]:_MessageStatus_index[i+1]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment