Documentation
¶
Overview ¶
Package srcref formats AST positions as repo-relative "file:line" references suitable for embedding in generated reference docs.
Generators usually want to point a reader at the exact source line that defines a flag, route, or config field. srcref handles the fiddly bits: resolving go/token.Pos against a FileSet, trimming an absolute path to a repo-relative one, and degrading gracefully when the position is invalid.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SrcRef ¶
type SrcRef struct {
// contains filtered or unexported fields
}
SrcRef formats positions against a shared FileSet.
func New ¶
New returns a SrcRef bound to fset. The FileSet must outlive the SrcRef; it typically lives for the duration of a single docsgen run.
Click to show internal directories.
Click to hide internal directories.