fxreflect

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Caller

func Caller() string

Caller returns the formatted calling func name

func FuncName

func FuncName(fn interface{}) string

FuncName returns a funcs formatted name

Types

type Frame added in v1.10.0

type Frame struct {
	// Unique, package path-qualified name for the function of this call
	// frame.
	Function string

	// File and line number of our location in the frame.
	//
	// Note that the line number does not refer to where the function was
	// defined but where in the function the next call was made.
	File string
	Line int
}

Frame holds information about a single frame in the call stack.

func (Frame) String added in v1.10.0

func (f Frame) String() string

type Stack added in v1.10.0

type Stack []Frame

Stack is a stack of call frames.

Formatted with %v, the output is in a single-line, in the form,

foo/bar.Baz() (path/to/foo.go:42); bar/baz.Qux() (bar/baz/qux.go:12); ...

Formatted with %+v, the output is in the form,

foo/bar.Baz()
	path/to/foo.go:42
bar/baz.Qux()
	bar/baz/qux.go:12

func CallerStack added in v1.10.0

func CallerStack(skip, depth int) Stack

CallerStack returns the call stack for the calling function, up to depth frames deep, skipping the provided number of frames, not including Callers itself.

If zero, depth defaults to 8.

func (Stack) CallerName added in v1.10.0

func (fs Stack) CallerName() string

CallerName returns the name of the first caller in this stack that isn't owned by the Fx library.

func (Stack) Format added in v1.10.0

func (fs Stack) Format(w fmt.State, c rune)

Format implements fmt.Formatter to handle "%+v".

func (Stack) String added in v1.10.0

func (fs Stack) String() string

String returns a single-line, semi-colon representation of a Stack. For a list of strings where each represents one frame, use Strings. For a cleaner multi-line representation, use %+v.

func (Stack) Strings added in v1.20.0

func (fs Stack) Strings() []string

Strings returns a list of strings, each representing a frame in the stack. Each line will be in the form,

foo/bar.Baz() (path/to/foo.go:42)

Jump to

Keyboard shortcuts

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