INTEGER

A Go type is generated for the ASN.1 INTEGER type which equates the ASN.1 type assignment to a built-in Go 64-bit integer type. For an unconstrained integer type, the Go type used is a signed 64-bit integer (int64). For example:

ASN.1:

   MyInt ::= INTEGER

Generated Go code:

   type MyInt int64

If a constraint constrains the value to a nonnegative range, an unsigned 64-bit integer type is used (uint64):

ASN.1:

   MyUInt ::= INTEGER (0..9)

Generated Go code:

   type MyInt uint64

Note that no attempt is made to used smaller integer types for smaller ranges.

If an INTEGER type is referenced directly in an element within a constructed type, the Go integer type is referenced directly.

If the INTEGER type contains a list of named numbers, Go constants are generated for each number, the same as is done for the ASN.1 ENUMERATED type.