Documentation ¶
Overview ¶
Package genutil provides utilities to help "go generate" implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateConstants ¶
GenerateConstants reads consts from input and generate output Go source file using a text/template.
Types ¶
type GroupSpec ¶
type GroupSpec struct { Prefix string // constant prefix used as group identifier, e.g, the prefix for "KEY_*" should be "KEY". TypeName string // constant type name, e.g. "EventCode" Desc string // human-readable group description used in comment }
GroupSpec describes how to make a group of constants.
type LineParser ¶
LineParser is a type to parse a line.
type Params ¶
type Params struct { PackageName string // Go package name, e.g. "input" RepoName string // repo name, e.g "Linux kernel" PreludeCode string // Go code to include at the top of file (typically "//go:generate go run ...") CopyrightYear int // copyright year used in the license, e.g "2018" MainGoFilePath string // name of the main .go file for generating the constants, e.g "gen/gen_constants.go" Types []TypeSpec // specification of types to be defined Groups []GroupSpec // specification of groups of constants LineParser LineParser // parser for each line in the input file }
Params controls the detailed behavior of GenerateConstants.
Click to show internal directories.
Click to hide internal directories.