caller

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsString

func AsString() string

AsString returns a pre-formatted string from the caller.Get() function using the following format: `fileName#lineNumber`, eg.

// /path/to/calling_file.go#22
fmt.Println(caller.AsString())

func Get

func Get() (file string, line int, found bool)

Get returns the calling location (file and line number) if found, eg.

if file, line, ok := caller.Get(); ok {
	// /path/to/calling_file.go  11
	fmt.Println(file, line)
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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