Documentation ¶
Overview ¶
Package template contains utilities for working with Go templates. Most of the utilities here are convenience methods focused on writing templates to disk.
Index ¶
- func CheckMissingFields(tpl FieldCheck, data MapData) (err error)
- func GlobBatch(glob, target string) (map[string]string, error)
- func WriteFile(file string, tpl *template.Template, data interface{}, mode os.FileMode) (err error)
- type BatchTemplater
- type FieldCheck
- type FileBatchTemplater
- type MapData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMissingFields ¶
func CheckMissingFields(tpl FieldCheck, data MapData) (err error)
Types ¶
type BatchTemplater ¶
type BatchTemplater interface { // The keys in the provided map are read as templates from // a data source. The result of executing each template // with the provided data is written into the data source named by the // corresponding value. Any errors will result in the operation // being aborted. Execute(templates map[string]string, data interface{}) (err error) }
A batch templater is used to apply the same data to a batch of templates.
type FieldCheck ¶
type FileBatchTemplater ¶
A FileBatchTemplater is a BatchTemplater that uses files as a data source and sink
func NewFileBatchTemplater ¶
func NewFileBatchTemplater(perm os.FileMode) *FileBatchTemplater
Creates a new batched templater which will write files out with the specified permissions.
Click to show internal directories.
Click to hide internal directories.