Documentation ¶
Index ¶
- Constants
- type AstDepth
- type ImportError
- type Loader
- type LoaderOptions
- type LoaderOptionsFunc
- type Log
- func (l *Log) Debugf(msg string, v ...interface{})
- func (l *Log) Errorf(msg string, v ...interface{})
- func (l *Log) Infof(msg string, v ...interface{})
- func (l *Log) Printf(msg string, v ...interface{})
- func (l *Log) SetLevel(lvl LogLevel)
- func (l *Log) Verbosef(msg string, v ...interface{})
- func (l *Log) Warnf(msg string, v ...interface{})
- type LogLevel
- type Package
- type Program
Constants ¶
const ( // DefaultAstDepth specifies that the AST loader will only inspect the specified // package DefaultAstDepth AstDepth = Shallow // DefaultDepth specifies that there is no limit to the number of imports that // the AST loader will delve into DefaultDepth int = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AstDepth ¶
type AstDepth int
AstDepth directs the classifications of packages inspected
const ( // Shallow addresses the contents of the package Shallow AstDepth = iota // Deep addresses the contents of the given package and all its referenced children Deep // Local addresses the contents of all packages in the same organization Local // Wide addresses the contents of all directly and indirectly imported non-stdlib packages Wide // Complete addresses the contents of every imported package, including stdlib Complete )
func CheckAstDepth ¶
CheckAstDepth validates the AstDepth flag
type ImportError ¶
ImportError is an error that comes from reading the import chain
func NewImportError ¶
func NewImportError(packageName string, currentPackage *build.Package, base error) ImportError
NewImportError returns a new import error
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader will load code into an AST
type LoaderOptions ¶
LoaderOptions are the options used by the Loader to limit package transversal
func NewLoaderOptions ¶
func NewLoaderOptions(l *Log, funcs ...LoaderOptionsFunc) *LoaderOptions
NewLoaderOptions creates a new LoaderOptions struct and preconfigures it using any provided funcs.
type LoaderOptionsFunc ¶
type LoaderOptionsFunc func(lo *LoaderOptions) (*LoaderOptions, error)
LoaderOptionsFunc allows functions to determine the state of the LoaderOptions
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is a fairly basic logger
func GetLog ¶
GetLog will return a log for the given name, creating one with the provided writer as needed
func (*Log) Debugf ¶
Debugf will write if the log level is at least Debug. If the pointer receiver is nil, the log for `os.Stdout` will be used.
func (*Log) Errorf ¶
Errorf will write if the log level is at least Error. If the pointer receiver is nil, the log for `os.Stdout` will be used.
func (*Log) Infof ¶
Infof will write if the log level is at least Info. If the pointer receiver is nil, the log for `os.Stdout` will be used.
func (*Log) Printf ¶
Printf will always log the given message, regardless of log level set. If the pointer receiver is nil, the log for `os.Stdout` will be used.
func (*Log) SetLevel ¶
SetLevel will adjust the logger's level. If the pointer receiver is nil, the log for `os.Stdout` will be used.
type LogLevel ¶
type LogLevel int
LogLevel is the logging level: None, Error, Warn, Info, Verbose, or Debug
const ( // None means that the log should never write None LogLevel = iota // Error means that only errors will be written Error // Warn means that errors and warnings will be written Warn // Info logging writes info, warning, and error Info // Verbose logs everything bug debug-level messages Verbose // Debug logs every message Debug )
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package represents a Go package
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is a mass of code
func (*Program) FileSet ¶
FileSet returns the set of files involved across all packages loaded for this program