General Form of a Generated Go Source File

A generated Go file begins with package asn1gen. All generated Go code is included in the asn1gen package.

After that is an import statement, which will import the base run-time package, asn1rt, and any required built-in Go packages. This is followed by type and constant definitions. See the ASN.1 To Go Type Mappings section for details on the mapping of ASN.1 types to Go types.

For PER, type-specific encode and decode functions are generated. For JSON, custom marshal and unmarshal functions are generated for some types. The built-in Go marshaling logic is used wherever possible to do the JSON conversion.