Skip to content

go-courier/enumeration

Repository files navigation

Enumeration

GoDoc Widget Build Status codecov Go Report Card

Enumeration in go

// declare named type base on int or uint
type Protocol int

// declare const as the declared type
// and with prefix upper-snake-cased type name
// link with UNKNOWN by one lodash _ as the zero value
// link with ENUM VALUE by two lodash __ as enum values
// comments after enum values will be the label of matched enum value
const (
	PROTOCOL_UNKNOWN Protocol = iota
	PROTOCOL__HTTP    // http
	PROTOCOL__HTTPS   // https
	PROTOCOL__TCP
)