我有
const (
BlahFoo = 1 << iota
MooFoo
)
Run Code Online (Sandbox Code Playgroud)
然后
type Cluster struct {
a int
b int
}
Run Code Online (Sandbox Code Playgroud)
我希望Cluster.a只是BlahFoo或MooFoo
我该如何执行?
type FooEnum int
const (
BlahFoo FooEnum = 1 << iota
MooFoo
)
type Cluster struct {
a FooEnum
b int
}
Run Code Online (Sandbox Code Playgroud)