go: give enums their own scalar types

This commit is contained in:
rw
2018-07-26 16:40:56 -07:00
parent 2361dfb66a
commit f675f6433c
4 changed files with 48 additions and 34 deletions

View File

@@ -2,14 +2,15 @@
package Example
type Any = byte
const (
AnyNONE = 0
AnyMonster = 1
AnyTestSimpleTableWithEnum = 2
AnyMyGame_Example2_Monster = 3
AnyNONE Any = 0
AnyMonster Any = 1
AnyTestSimpleTableWithEnum Any = 2
AnyMyGame_Example2_Monster Any = 3
)
var EnumNamesAny = map[int]string{
var EnumNamesAny = map[Any]string{
AnyNONE:"NONE",
AnyMonster:"Monster",
AnyTestSimpleTableWithEnum:"TestSimpleTableWithEnum",

View File

@@ -2,13 +2,14 @@
package Example
type Color = int8
const (
ColorRed = 1
ColorGreen = 2
ColorBlue = 8
ColorRed Color = 1
ColorGreen Color = 2
ColorBlue Color = 8
)
var EnumNamesColor = map[int]string{
var EnumNamesColor = map[Color]string{
ColorRed:"Red",
ColorGreen:"Green",
ColorBlue:"Blue",