generate

package
v0.0.0-...-cca3eb9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Config packages.Config
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(debug bool) *Generator

func (Generator) Debug

func (g Generator) Debug(templ string, k ...interface{})

Debug prints debug statements if debug is true.

func (*Generator) ExecuteGoCmd

func (g *Generator) ExecuteGoCmd(ctx context.Context, args []string, env []string) error

ExecuteGoCmd runs the 'go' command with certain parameters.

func (*Generator) GenerateAndExecuteFile

func (g *Generator) GenerateAndExecuteFile(ctx context.Context, imports []string, extraStatements string) error

GenerateAndExecuteFile generates and executes a temp file with the given imports

func (*Generator) GenerateFile

func (g *Generator) GenerateFile(imports []string, extraStatements, path string) error

GenerateFile generates a injected file.

func (*Generator) GetExports

func (g *Generator) GetExports(importName string, files []*ast.File, added map[string]bool) (string, error)

GetExports returns a string of gocode that represents the exports (constants/functions) of an ast.Package.

func (*Generator) InjectPry

func (g *Generator) InjectPry(filePath string) (string, error)

InjectPry walks the scope and replaces pry.Pry with pry.Apply(pry.Scope{...}).

func (*Generator) RevertPry

func (g *Generator) RevertPry(modifiedFiles []string) error

RevertPry reverts the changes made by InjectPry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL