internal

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectCaseInfo

func CollectCaseInfo(f *ast.File) (caseByBody map[ast.Stmt]*CaseInfo)

func CollectForInfo

func CollectForInfo(f *ast.File) (forByBody map[ast.Stmt]*ForInfo)

func CollectFuncInfo

func CollectFuncInfo(f *ast.File) (funcByBody map[ast.Stmt]*FuncInfo)

func CollectIfElseInfo

func CollectIfElseInfo(f *ast.File) (ifElseByBody map[ast.Stmt]*IfElseInfo)

func GetLibraryCode

func GetLibraryCode(packageName, uniqueString string, w io.Writer) (err error)

func ProcessCode

func ProcessCode(config Config, filename string, src []byte) (dst []byte, err error)

func SaveFile

func SaveFile(dst string, fileContent string) error

func TransformFile

func TransformFile(src, dst string, transform func(r io.Reader, w io.Writer) (err error)) error

Types

type CaseInfo

type CaseInfo struct {
	Case *ast.CaseClause
	Comm *ast.CommClause
}

func (CaseInfo) CaseLabel

func (i CaseInfo) CaseLabel() (begin, end token.Pos)

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 (cfg *Config) ExecutableFileName() string

func (*Config) IdentifierPrintlnCall

func (cfg *Config) IdentifierPrintlnCall() string

func (*Config) IdentifierPrintlnReturn

func (cfg *Config) IdentifierPrintlnReturn() string

func (*Config) IdentifierPrintlnReturnVariable

func (cfg *Config) IdentifierPrintlnReturnVariable() string

func (*Config) IdentifierPrintlnStatement

func (cfg *Config) IdentifierPrintlnStatement() string

func (*Config) IdentifierPrintlnVariable

func (cfg *Config) IdentifierPrintlnVariable() string

func (*Config) LibraryFileName

func (cfg *Config) LibraryFileName() string

func (*Config) LibraryImportPath

func (cfg *Config) LibraryImportPath() string

func (*Config) LibraryPackageName

func (cfg *Config) LibraryPackageName() string

type ForInfo

type ForInfo struct {
	Body  *ast.BlockStmt
	For   *ast.ForStmt
	Range *ast.RangeStmt
}

func (ForInfo) Variables

func (i ForInfo) Variables() (vars []*ast.Ident)

type FuncInfo

type FuncInfo struct {
	Body     *ast.BlockStmt
	FuncDecl *ast.FuncDecl
	FuncLit  *ast.FuncLit
}

func (FuncInfo) Signature

func (i FuncInfo) Signature() (begin, end token.Pos)

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 (x *Xtrace) IdentShowGoroutine() string

func (*Xtrace) IdentShowTimestamp

func (x *Xtrace) IdentShowTimestamp() string

type XtraceGoData

type XtraceGoData struct {
	PackageName  string
	UniqueString string
}

Jump to

Keyboard shortcuts

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