Documentation
¶
Index ¶
- type Decl
- type File
- type FuncDecl
- func (d *FuncDecl) Body(code ...jen.Code) *FuncDecl
- func (d *FuncDecl) BodyFunc(fn func(g *jen.Group)) *FuncDecl
- func (d *FuncDecl) Code() *jen.Statement
- func (d *FuncDecl) Name() string
- func (d *FuncDecl) Params(params ...jen.Code) *FuncDecl
- func (d *FuncDecl) Qual() *jen.Statement
- func (d *FuncDecl) Results(results ...jen.Code) *FuncDecl
- func (d *FuncDecl) TypeParams(params ...jen.Code) *FuncDecl
- type Generator
- func (g *Generator) File(pkg *pkginfo.Package, shortName string) *File
- func (g *Generator) InjectFile(pkgPath paths.Pkg, pkgName string, pkgDir paths.FS, baseName, shortName string) *File
- func (g *Generator) InsertTestSupport(pkg *pkginfo.Package)
- func (g *Generator) Overlays() []overlay.File
- func (g *Generator) Rewrite(file *pkginfo.File) *rewrite.Rewriter
- type TestConfig
- type VarDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Jen *jen.File // the jen file we're generating
// contains filtered or unexported fields
}
File represents a generated file for a specific package.
func (*File) ImportAnon ¶
ImportAnon adds an anonymous ("_"-prefixed) import of the given packages.
type FuncDecl ¶
type FuncDecl struct {
File *File // file the declaration belongs to.
// contains filtered or unexported fields
}
FuncDecl represents a generated declaration.
type Generator ¶
type Generator struct {
*parsectx.Context
Util *genutil.Helper
TraceNodes *legacymeta.TraceNodes
// contains filtered or unexported fields
}
func New ¶
func New(c *parsectx.Context, traceNodes *legacymeta.TraceNodes) *Generator
func (*Generator) InjectFile ¶
func (*Generator) InsertTestSupport ¶ added in v1.16.0
InsertTestSupport inserts an import of the testsupport package in the given package.
type TestConfig ¶
type TestConfig struct {
// Packages are the packages to generate test code for.
Packages []*pkginfo.Package
// EnvsToEmbed are the environment variables to embed inside
// the test binaries themselves. This is useful when
// building tests with "go test -c", where the binary is
// built first and executed later (such as by GoLand).
EnvsToEmbed map[string]string
}
TestConfig describes common configuration for code generation when running tests.
Click to show internal directories.
Click to hide internal directories.