stacktrace

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 6 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 {
	PC       uintptr
	File     string
	Function string
	Line     int
}

Frame represents a single stack frame with debugging information. This struct contains information about a function call location, including the file, line number, function name, and program counter.

func NewFrameFromCaller

func NewFrameFromCaller() (Frame, bool)

NewFrameFromCaller creates a new Frame from the current call stack. This function walks up the call stack to find the first frame that is not in the do package or Go runtime, providing useful debugging information about where a service was invoked from.

The function filters out:

  • Frames in the Go runtime (GOROOT)
  • Frames in the do package (except examples and tests)
  • Frames in the stacktrace package

Returns a Frame representing the caller and a boolean indicating success. The boolean is false if no suitable frame was found.

This function is used internally by the DI container to track service invocation locations for debugging and explanation purposes.

func NewFrameFromPC

func NewFrameFromPC(pc uintptr) (Frame, bool)

NewFrameFromPC creates a new Frame from a program counter (PC) value. This function is used to create Frame objects from function pointers, typically for tracking where service providers were defined.

Parameters:

  • pc: The program counter value representing a function

Returns a Frame representing the function and a boolean indicating success. The boolean is false if the PC value is invalid.

This function is used internally to track service provider locations for debugging and explanation purposes.

func (Frame) String

func (f Frame) String() string

String returns a formatted string representation of the frame. The format is "file:function:line" which is useful for debugging and logging purposes.

Returns a string in the format "path/to/file.go:FunctionName:123".

Jump to

Keyboard shortcuts

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