location

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 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
	BehindCmp bool   // BehindCmp is true when operator is behind a Cmp* function
}

Location record 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, false is returned and the Location is not valid.

func (Location) IsInitialized

func (l Location) IsInitialized() bool

IsInitialized returns true if the Location 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