I need to create many uint32 tags which are mapping of ASCII letters. For instance the tag "abcd" is encoded as 0x61626364 where each byte correspond to the ASCII code of the letter.
A straightforward solution is to define the tag values like this
type Tag uint32
const Tag_abcd = Tag(0x61626364)
But this is error prone.
A less error prone solution would be to define the tag values with a function receiving the letters as argument.
const Tag_abcd = foo("abcd")
or like this as can easily been done with a macro in C
const Tag_abcd = bar('a','b','c','d')
But this would require support of functions evaluated at compile time. As far as I know, it is not possible with Go. Am I correct ? Could there be another way ?