ASN1C Go Command Line Options

The following table shows a summary of the command line options that have meaning when generating Go code:

Option Argument Description
-config <filename> This option is used to specify the name of a file containing configuration information for the source file being parsed. A full discussion of the contents of a configuration file is provided in the Compiler Configuration File section.
-depends None Without this option, the compiler only generates Go code for the files that were explicitly given as input, and not for any files it may automatically load on account of IMPORTS. This option tells the compiler to also generate code for files it automatically loads, but only that code which is necessary to satisfy dependencies that originate in the main file set.

-genPrint 
            -print

None Generate code to print object contents. The open source go-spew package (https://github.com/davecgh/go-spew) is used for this purpose.

-genTest 
            -test

None

Generate code to populate a PDU object with random test data. This code will be embedded in the body of a generated main.go program.

-I <directory> This option specifies a directory where the compiler should search for ASN.1 source files for IMPORT items. Multiple –I qualifiers can be used to specify multiple directories to search.
-lax None Suppress generation of code to check constraints.
-list None Generate listing. This will dump the source ASN.1 to the standard output device as it is parsed. This can be useful for finding parse errors.
-nodecode None Suppress generation of decode functions.
-noencode None Suppresses generation of encode functions.
-noOpenExt None Suppress the generation of open extension elements in constructs that contain extensibility markers. The purpose of the element is to collect any unknown items in a message. If an application does not care about these unknown items, it can use this option to reduce the size of the generated code and increase performance.
-noUniqueNames None

Turn off the capability to automatically generate unique names to resolve name collisions in the generated code. Name collisions can occur, for example, if two modules are being compiled that contain a production with the same name. A unique name is generated by prepending the module name to one of the productions to form a name of the form <module>_<name>.

Note that name collisions can also be manually resolved by using the typePrefix, enumPrefix, and valuePrefix configuration items (see the Compiler Configuration File section for more details).

-no-go-main None Suppress the generation of a main.go file. By default, this file is generated with options to encode (-writer) and decode (-reader) a message of a PDU type.
-o <directory> Specify the name of a directory to which all of the generated files will be written.
-pdu <typeName>

Designate given type name to be a Protocol Definition Unit (PDU) type. By default, PDU types are determined to be types that are not referenced by any other types within a module. This option allows that behavior to be overridden.

-shortnames None Change the names generated by compiler for embedded types in constructed types.
-tables None Generate additional code for the handling of table constraints as defined in the X.682 standard.
-warnings None Output information on compiler generated warnings.