package envconf type DataType int const ( TypeNone DataType = iota TypeInt DataType = iota TypeDuration DataType = iota TypeString DataType = iota TypeBool DataType = iota ) func (dtype DataType) String()(string) { types := make(map[DataType]string) types[TypeNone] = "none" types[TypeInt] = "int" types[TypeDuration] = "duration" types[TypeString] = "string" types[TypeBool] = "bool" str, ok := types[dtype] if ok { return str } return "invalid" }