templates

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFuncMap

func GetFuncMap(failMessage *string) template.FuncMap

GetFuncMap returns the list of functions provided by sprig. It changes the function "fail" to set the given string, this way we can report template errors directly to the template without having the wrapper that text/template adds.

sprig "env" and "expandenv" functions are removed to avoid the leak of information.

func ValidateTemplate

func ValidateTemplate(data []byte, funcMap template.FuncMap) error

ValidateTemplate validates a text template results in valid JSON when it's executed with empty template data. If template execution results in invalid JSON, the template is invalid. When the template is valid, it can be used safely. A valid template can still result in invalid JSON when non-empty template data is provided.

func ValidateTemplateData

func ValidateTemplateData(data []byte) error

ValidateTemplateData validates that template data is valid JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

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