When Go code is generated, the output directory (which defaults to the current working directory) is the root of the Go module. ASN1C will use the last part of the directory name as the Go module path, e.g. if the output directory is .../some/project1, the Go module path will be "project1". If a go.mod file does not exist in this location, one will be created with this module path. If a main.go file is being generated, it will also be generated here.
ASN1C will generate a Go package, in this module path, named asn1gen
.
This package name can be changed using the -pkgname
option.
A corresponding subdirectory will be created using this name. Files generated in this
directory will contain the corresponding package clause of package asn1gen
.
Within this directory, subdirectory asn1rt
will be created.
The directory asn1gen/asn1rt
contains the
asn1rt
package, which is the package for the
base run-time.
Separate files are generated for each ASN.1 module in the asn1gen
package, but everything is in that one package (aside from the run-time layer).
Executing “go build” will build the full package.