mage: Index | Files

package parse

import ""


Package Files


func EnableDebug Uses

func EnableDebug()

EnableDebug turns on debug logging.

type Function Uses

type Function struct {
    PkgAlias   string
    Package    string
    ImportPath string
    Name       string
    Receiver   string
    IsError    bool
    IsContext  bool
    Synopsis   string
    Comment    string

Function represented a job function from a mage file

func (Function) ExecCode Uses

func (f Function) ExecCode() (string, error)

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 Uses

func (f Function) ID() string

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

func (Function) TargetName Uses

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 Import Uses

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 PkgInfo Uses

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

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

func Package Uses

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

Package compiles information about a mage package.

func PrimaryPackage Uses

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.

Package parse imports 12 packages (graph) and is imported by 4 packages. Updated 2020-01-14. Refresh now. Tools for package owners.