template

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package template renders Go templates against source/version data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuotedRefs

func QuotedRefs(tmpl string, roots ...string) []string

QuotedRefs reports each root-derived action that IS piped through shellquote but sits inside a quoted string of the surrounding command: shellquote makes a word, and a word written inside "…" or '…' is no longer one — "$(id)" still substitutes, and '{{ x }}' closes the quote around a value holding one. Each is returned once, as text/template prints the action.

Quoting is followed through the template's text in document order, as sh reads it. ponytail: it does not know which branch of an if ran, so a template that opens a quote in one branch and closes it in another can be over- or under-reported.

func Render

func Render(tmpl string, data map[string]any) (string, error)

Render renders a Go template against data (typically map[string]any{"source": ..., "version": ...}).

func UnquotedRefs

func UnquotedRefs(tmpl string, roots ...string) []string

UnquotedRefs reports each action in tmpl that prints a value derived from one of roots (".version", ".args", ...) without ending in shellquote — the spots where a value reaches `sh -c` as shell syntax rather than as a word. Each is returned once, as text/template prints the action. An unparsable template reports nothing: rendering it fails louder than this could.

A value is derived from a root when it is reached through a field of it, through a dot rebound by with/range over it, or through a variable assigned from it. ponytail: variables are tracked by name across the whole template, not by scope — a shadowing $x can be over- or under-reported.

Types

This section is empty.

Jump to

Keyboard shortcuts

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