<三> go 枚举
在go语言中,没有直接支持枚举的关键字,也就造成go没有直接枚举的功能。但是go提供另一种方法来实现枚举,那就是const+iota // 实现枚举例子 type State int // iota 初始化后会自动递增 const ( Running State = iota // value --> 0 Stopped // value --> 1 Rebooting // value --> 2 Terminated // value --> 3 ) func (this State) String() string { switch this { case Running: return "Running" case Stopped: return "Stopped" default:...阅读全文