parse

package
v0.0.0-...-184e7a2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableDebug

func EnableDebug()

EnableDebug turns on debug logging.

Types

type Arg

type Arg struct {
	Name, Type string
}

Arg is an argument to a Function.

type Function

type Function struct {
	PkgAlias   string
	Package    string
	ImportPath string
	Name       string
	Receiver   string
	IsError    bool
	IsContext  bool
	Synopsis   string
	Comment    string
	Args       []Arg
}

Function represents a job function from a mage file

func (Function) ExecCode

func (f Function) ExecCode() string

ExecCode returns code for the template switch to run the target. It wraps each target call to match the func(context.Context) error that runTarget requires.

func (Function) ID

func (f Function) ID() string

ID returns user-readable information about where this function is defined.

func (Function) TargetName

func (f Function) TargetName() string

TargetName returns the name of the target as it should appear when used from the mage cli. It is always lowercase.

type Functions

type Functions []*Function

Functions implements sort interface to optimize compiled output with deterministic generated mainfile.

func (Functions) Len

func (s Functions) Len() int

func (Functions) Less

func (s Functions) Less(i, j int) bool

func (Functions) Swap

func (s Functions) Swap(i, j int)

type Import

type Import struct {
	Alias      string
	Name       string
	UniqueName string // a name unique across all imports
	Path       string
	Info       PkgInfo
}

Import represents the data about a mage:import package

type Imports

type Imports []*Import

Imports implements sort interface to optimize compiled output with deterministic generated mainfile.

func (Imports) Len

func (s Imports) Len() int

func (Imports) Less

func (s Imports) Less(i, j int) bool

func (Imports) Swap

func (s Imports) Swap(i, j int)

type PkgInfo

type PkgInfo struct {
	AstPkg      *ast.Package
	DocPkg      *doc.Package
	Description string
	Funcs       Functions
	DefaultFunc *Function
	Aliases     map[string]*Function
	Imports     Imports
}

PkgInfo contains inforamtion about a package of files according to mage's parsing rules.

func Package

func Package(path string, files []string) (*PkgInfo, error)

Package compiles information about a mage package.

func PrimaryPackage

func PrimaryPackage(gocmd, path string, files []string) (*PkgInfo, error)

PrimaryPackage parses a package. If files is non-empty, it will only parse the files given.

Jump to

Keyboard shortcuts

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