callstack

package
v0.0.0-...-bd5799c Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	// contains filtered or unexported fields
}

Frame wraps runtime.Frame with extra functionality

func (Frame) File

func (frame Frame) File() string

File gets the path and file name of this Frame

func (Frame) FileName

func (frame Frame) FileName() string

FileName gets the file name of this Frame

func (Frame) Func

func (frame Frame) Func() string

Func gets the fully-qualified name of the function

func (Frame) FuncName

func (frame Frame) FuncName() string

FuncName gets the non-qualified name of the function.

func (Frame) Line

func (frame Frame) Line() int

Line gets the line number of this Frame

func (Frame) PC

func (frame Frame) PC() uintptr

PC gets the raw program counter

func (Frame) PkgAndFunc

func (frame Frame) PkgAndFunc() (pkgPath string, funcName string)

PkgAndFunc gets the name of the package this frame belongs to and the non-qualified name of the function in the package.

func (Frame) PkgPath

func (frame Frame) PkgPath() string

PkgPath gets the name of the package the frame belongs to

func (Frame) String

func (frame Frame) String() string

String implements fmt.Stringer

type PC

type PC uintptr

Raw program counter wrapper

func Caller

func Caller(skip int) PC

Caller gets the PC of the caller after skipping the given number of frames

func Self

func Self() PC

Self gets the PC of the caller

func (PC) Frame

func (pc PC) Frame() Frame

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

A Stack is an immutable stack trace

func Get

func Get() Stack

Get gets a stack trace at the caller's location

func GetSkip

func GetSkip(skip int) Stack

GetSkip gets the stack, skipping the first skip number of frames

func (Stack) All

func (st Stack) All() iter.Seq[Frame]

All returns an iterator over every frame in the stack.

func (Stack) IsZero

func (st Stack) IsZero() bool

IsZero determines if this stack is a zero-value

func (Stack) Slice

func (st Stack) Slice() []Frame

func (Stack) String

func (st Stack) String() string

String implements fmt.Stringer

Jump to

Keyboard shortcuts

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