Documentation ¶
Overview ¶
Package lutgen provides tools to generate lookup tables for Go binaries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binary ¶
Binary wraps the information about a single compiled test binary that is given to the inspection callback.
type LookupFunction ¶
type LookupFunction struct { Name string OutputType string OutputZeroValue string ExtractValue func(inspectionResult interface{}) interface{} RenderValue func(value interface{}) string DocComment string }
LookupFunction configures a single lookup table as a Go function that maps an input Go version/architecture to the specified output type.
type LookupTableGenerator ¶
type LookupTableGenerator struct { Package string MinGoVersion goversion.GoVersion Architectures []string CompilationParallelism int LookupFunctions []LookupFunction ExtraImports []string InspectBinary func(binary Binary) (interface{}, error) TestProgramPath string InstallDirectory string OutDirectory string // contains filtered or unexported fields }
LookupTableGenerator configures the process of generating a Go source file that implements lookup table(s) for any value based on an input Go version and Go architecture. This can be used to resolve values about a binary that change based on the Go version/architecture, by compiling and inspecting small test binaries ahead-of-type for each Go version/architecture and generating the lookup table(s) based on the results of this process.
Each lookup table is implemented as a function, which are configured in LookupFunction types.
func (*LookupTableGenerator) Run ¶
Run runs the generator to completion, writing the generated Go source code to the given writer. If an error occurs installing Go toolchain versions, compiling the test program, or running the inspection function (or if the context is cancelled), then the function will return early.