The CDDL language supports some primitives as type constraints. These primitives - uint, int, bytes, bstr, text/tstr are directly translated to Go type declarations.
From the definition file primitives.cddl containing the following content,
This generates the declarations and validation methods. Since the types are directly enforced by the Go type checker, the Valid() methods return nil by default. All values are public by default with identifiers formatted as PascalCase.
/* File generated using `cddlc.exe gen`. DO NOT EDIT*/packagefoo// (cddlc) Ident: nametypeNamestring// Valid evaluates type constraints on name and returns nil if valid // else it returns a list of validation errorsfunc(name*Name)Valid()error{returnnil}// (cddlc) Ident: agetypeAgeuint// Valid evaluates type constraints on age and returns nil if valid // else it returns a list of validation errorsfunc(age*Age)Valid()error{returnnil}// (cddlc) Ident: public-keytypePublicKey[]byte// Valid evaluates type constraints on public-key and returns nil if valid // else it returns a list of validation errorsfunc(public-key*PublicKey)Valid()error{returnnil}// (cddlc) Ident: account-balancetypeAccountBalanceint// Valid evaluates type constraints on account-balance and returns nil if valid // else it returns a list of validation errorsfunc(account-balance*AccountBalance)Valid()error{returnnil}