I wish to create an "enum-like" list of constants with the following properties:
- The values of each identifier are sequential, with a few gaps. (I believe iota and the blank identifier help in this regard).
- The identifiers are private to the module.
- The constants can only be compared with other constants of the same type.
The enumeration is based on the enum fuse_opcode
from FUSE. Here's some code for what I'm trying to accomplish (and also very wrong):
const Opcode (
_ = iota // skip 0
lookupOp
forgetOp
getattrOp
setattrOp
readlinkOp
symlinkOp // 6
_ // skip 7
mknodOp // 8
// et cetera ad nauseam
)
Here's the Go code for the FUSE opcodes. It was created from enum fuse_opcode. Typically you would write a script to do that; I used a text editor. Since the constant values match the C enum values, explicit values are used.