package constant // Status 启用禁用 type Status int const ( Disabled Status = iota Enabled ) var StatusMap = map[Status]string{ Disabled: "禁用", Enabled: "启用", } func (u Status) String() string { if v, ok := StatusMap[u]; ok { return v } return "未知类型" }