On 2 July 2012 15:57, bsr <
bsr...@gmail.com> wrote:
>
> What is the best way to have a set of string constants. This way, I can
> enforce keys as one of the members of the group. I was thinking something
> line
>
> const TMessageType = [string]{"ALERT", "ERROR", "SUCCESS", "INFO"}
Bad syntax: []string, not [string]. But ...
> or
> const TMessageType = [4]string{"ALERT", "ERROR", "SUCCESS", "INFO"}
> gives error. I am missing on the syntax or slice can't be const?.. thanks
... consts can only be numbers, booleans, and strings, not arrays or slices.
You can name the individual strings.