position

package
v1.235.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: Apache-2.0 Imports: 6 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

Overview

Package position maps text/template error positions back to the source file of a template that was rendered from derived text (re-serialized YAML or protected placeholders).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Remap

func Remap(err error, name string, texts Texts) error

Remap makes the position in a template error refer to the source file when the text that text/template parsed differs from it. The failing template action is located in the parsed text and in the source: when it can be tied to exactly one evaluated source location, the position is rewritten to that location; otherwise the position is removed, because a wrong position sends the user to an unrelated line.

Types

type Texts

type Texts struct {
	// Source is the file as written.
	Source string
	// Input is the text passed to the renderer: the source, or the YAML re-serialized from it for an import with a
	// context (keys sorted, comments dropped).
	Input string
	// Parsed is the text text/template parsed: input after protection replaced auth, YAML literal, Starlark and
	// encoded-literal sections with placeholders. Error positions refer to it.
	Parsed string
}

Texts are the versions of a template involved in rendering it.

Jump to

Keyboard shortcuts

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