re: Bit Hacking with Go VIEW POST

FULL DISCUSSION
 

A note on 'Bits as Configuration' - instead of assigning the values 1, 2, 4 & 8 manually you can use iota.

const (
    FlagA = (1 << iota)
    FlagB
    FlagC
    ...
)

Makes it easier to reorder and introduce new flags.

 
code of conduct - report abuse