import ""


Package meta is used to bootstrap the code generator. That is it contains code which generates Go code that gets compiled together with the user design package. The result of that compilation is a tool which generates the final code or documentation consumed by the end-user.


Package files

doc.go generator.go

type Generator

type Generator struct {
    // Genfunc contains the name of the generator entry point function.
    // The function signature must be:
    // func <Genfunc>([]dslengine.Root) ([]string, error)
    Genfunc string

    // Imports list the imports that are specific for that generator that
    // should be added to the main Go file.
    Imports []*codegen.ImportSpec

    // Flags is the list of flags to be used when invoking the final
    // generator on the command line.
    Flags map[string]string

    // CustomFlags is the list of arguments that appear after the -- separator.
    // These arguments are appended verbatim to the final generator command line.
    CustomFlags []string

    // OutDir is the final output directory.
    OutDir string

    // DesignPkgPath is the Go import path to the design package.
    DesignPkgPath string
    // contains filtered or unexported fields

Generator generates the code of, compiles and runs generators. This extra step is necessary to compile in the end user design package so that generator code can iterate through it.

func NewGenerator

func NewGenerator(genfunc string, imports []*codegen.ImportSpec, flags map[string]string, customflags []string) (*Generator, error)

NewGenerator returns a meta generator that can run an actual Generator given its factory method and command line flags.

func (*Generator) Generate

func (m *Generator) Generate() ([]string, error)

Generate compiles and runs the generator and returns the generated filenames.

Generated by godoc2md