sourcemap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatYAMLContext

func FormatYAMLContext(filePath string, targetLine int) string

FormatYAMLContext extracts lines around the target line in the source YAML file

Types

type Location

type Location struct {
	FilePath string
	Line     int
	Column   int
	KeyName  string // e.g. "update_policy", "file", "keys.letsencrypt"
	ZoneName string // Associated zone name if applicable
	Mixin    string // If inherited from a mixin
}

Location points to a specific line in a source file

type SourceMap

type SourceMap struct {
	Lines map[int]Location // 1-indexed output line -> Source Location
}

SourceMap correlates lines in generated BIND config with original YAML locations

func New

func New() *SourceMap

New creates a new empty SourceMap

func (*SourceMap) Add

func (sm *SourceMap) Add(outputLine int, loc Location)

Add maps an output line number to a source location

func (*SourceMap) Get

func (sm *SourceMap) Get(outputLine int) (Location, bool)

Get retrieves the source location for an output line number

func (*SourceMap) Shift added in v1.0.0

func (sm *SourceMap) Shift(offset int) *SourceMap

Shift returns a copy of the source map with every line key remapped by the given offset. It is used when lines are prepended to (or removed from) the generated config after the map was built, e.g. DNSSEC stub injection, so error line numbers reported against the modified file still resolve to the original YAML locations. Entries whose shifted key would be non-positive are dropped.

Jump to

Keyboard shortcuts

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