Documentation ¶
Overview ¶
Package src provides types for working with source files.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Position ¶
Position represents a position in a source file.
func FramePosition ¶
FramePosition returns the Position of the given stack frame.
func (Position) IsValid ¶
IsValid reports whether the position is valid: Line must be positive, but Filename may be empty.
Example ¶
package main import ( "fmt" "github.com/mmcloughlin/avo/src" ) func main() { fmt.Println(src.Position{"a.go", 42}.IsValid()) fmt.Println(src.Position{"", 42}.IsValid()) fmt.Println(src.Position{"a.go", -1}.IsValid()) }
Output: true true false
func (Position) Rel ¶
Rel returns Position relative to basepath. If the given filename cannot be expressed relative to basepath the position will be returned unchanged.
func (Position) Relwd ¶
Relwd returns Position relative to the current working directory. Returns p unchanged if the working directory cannot be determined, or the filename cannot be expressed relative to the working directory.
Click to show internal directories.
Click to hide internal directories.