Documentation
¶
Index ¶
- func CollectCaseInfo(f *ast.File) (caseByBody map[ast.Stmt]*CaseInfo)
- func CollectForInfo(f *ast.File) (forByBody map[ast.Stmt]*ForInfo)
- func CollectFuncInfo(f *ast.File) (funcByBody map[ast.Stmt]*FuncInfo)
- func CollectIfElseInfo(f *ast.File) (ifElseByBody map[ast.Stmt]*IfElseInfo)
- func GetLibraryCode(packageName, uniqueString string, w io.Writer) (err error)
- func ProcessCode(config Config, filename string, src []byte) (dst []byte, err error)
- func SaveFile(dst string, fileContent string) error
- func TransformFile(src, dst string, transform func(r io.Reader, w io.Writer) (err error)) error
- type CaseInfo
- type Config
- func (cfg *Config) ExecutableFileName() string
- func (cfg *Config) IdentifierPrintlnCall() string
- func (cfg *Config) IdentifierPrintlnReturn() string
- func (cfg *Config) IdentifierPrintlnReturnVariable() string
- func (cfg *Config) IdentifierPrintlnStatement() string
- func (cfg *Config) IdentifierPrintlnVariable() string
- func (cfg *Config) LibraryFileName() string
- func (cfg *Config) LibraryImportPath() string
- func (cfg *Config) LibraryPackageName() string
- type ForInfo
- type FuncInfo
- type IfElseInfo
- type ResolveType
- type ResolvedPackage
- type Xtrace
- type XtraceGoData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectIfElseInfo ¶
func CollectIfElseInfo(f *ast.File) (ifElseByBody map[ast.Stmt]*IfElseInfo)
func GetLibraryCode ¶
func ProcessCode ¶
Types ¶
type CaseInfo ¶
type CaseInfo struct {
Case *ast.CaseClause
Comm *ast.CommClause
}
type Config ¶
type Config struct {
TraceStmt bool
TraceVar bool
TraceCall bool
ShowTimestamp bool
ShowGoroutine bool
UniqueString string
LineWidth int
ResolveType ResolveType
ModuleName string
}
func (*Config) ExecutableFileName ¶
func (*Config) IdentifierPrintlnCall ¶
func (*Config) IdentifierPrintlnReturn ¶
func (*Config) IdentifierPrintlnReturnVariable ¶
func (*Config) IdentifierPrintlnStatement ¶
func (*Config) IdentifierPrintlnVariable ¶
func (*Config) LibraryFileName ¶
func (*Config) LibraryImportPath ¶
func (*Config) LibraryPackageName ¶
type IfElseInfo ¶
type IfElseInfo struct {
Body *ast.BlockStmt
ElseBody *ast.BlockStmt
Parents []*ast.IfStmt
IfStmt *ast.IfStmt
}
func (IfElseInfo) Variables ¶
func (i IfElseInfo) Variables() (vars []*ast.Ident)
type ResolveType ¶
type ResolveType string
const ( // ResolveTypeUnspecified Cannot resolve package. ResolveTypeUnspecified ResolveType = "" // ResolveType_CommandLineArguments Source files are specified and go.mod not found. // The source files must: // - have extension .go, // - be in the same directory, // - be in the main package, // - and contain only one main function. ResolveType_CommandLineArguments ResolveType = "command-line-arguments" // ResolveType_CommandLineArguments_Module Source files are specified and go.mod found. // The source files must: // - have extension .go, // - be in the same directory, // - be in the main package, // - and contain only one main function. // Multiple source files can be specified with a string of comma-separated source file paths. // Dependencies in the same module and external dependencies are resolved via go.mod. ResolveType_CommandLineArguments_Module ResolveType = "command-line-arguments(module)" // ResolveType_PackageDirectory_Module A directory of a main package is specified and go.mod found. // The directory must: // - have prefix '/', '.', or '..', // - and contain source files which are in the main package and contain only one main function. // Dependencies in the same module and external dependencies are resolved via go.mod. ResolveType_PackageDirectory_Module ResolveType = "package-directory(module)" )
type ResolvedPackage ¶
type ResolvedPackage struct {
ResolveType ResolveType
SourceFiles []string
PackageDir string
GoModFile string
Module string
}
func ResolvePackage ¶
func ResolvePackage(packageArg string) (resolved ResolvedPackage, err error)
type Xtrace ¶
type Xtrace struct {
Config
// contains filtered or unexported fields
}
func (*Xtrace) IdentShowGoroutine ¶
func (*Xtrace) IdentShowTimestamp ¶
type XtraceGoData ¶
Click to show internal directories.
Click to hide internal directories.