location

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetLocationer

type GetLocationer interface {
	GetLocation() Location
}

GetLocationer is the interface that wraps the basic GetLocation method.

type Location

type Location struct {
	File      string // File name
	Func      string // Function name
	Line      int    // Line number inside file
	Inside    string // Inside is used when Location is inside something else
	BehindCmp bool   // BehindCmp is true when operator is behind a Cmp* function
}

Location records a place in a source file.

func New

func New(callDepth int) (loc Location, ok bool)

New returns a new Location. callDepth is the number of stack frames to ascend to get the calling function (Func field), added to 1 to get the File & Line fields.

If the location can not be determined, ok is false and location is not valid.

func (Location) IsInitialized

func (l Location) IsInitialized() bool

IsInitialized returns true if l is initialized (e.g. [NewLocation] called without an error), false otherwise.

func (Location) String

func (l Location) String() string

Implements fmt.Stringer.

Jump to

Keyboard shortcuts

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