Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Globals = map[string]any{}
Globals is a map of template variables available in all Render calls. Built-in variables include ToolDir, RootDir, OS, and Arch. Packages can add their own globals (e.g., git package adds GitRoot).
To add custom variables:
template.Globals["Version"] = func() string { return "1.0.0" }
template.Globals["BuildTime"] = time.Now().Format(time.RFC3339)
Functions ¶
func Render ¶
Render processes a Go template string, substituting variables from Globals and any additional context maps provided. Variables can be values or functions (which are called during rendering).
Example:
Render("{{RootDir}}/.tool/{{OS}}_{{Arch}}")
Render("Hello {{.Name}}", map[string]any{"Name": "World"})
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.