file_resolver

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TemplateExtensionGoTemplate = "gotpl"

TemplateExtensionGoTemplate is the file extension used for Go template files.

Variables

View Source
var NoFileCandidatesErr = errors.New("no file candidates found")

NoFileCandidatesErr is returned when no matching file candidates exist on disk.

Functions

func CopyAndRenderFile

func CopyAndRenderFile(tmplCtx *templating.TemplateContext, src, target string) error

CopyAndRenderFile copies src to target, rendering it through a template processor if the file extension matches a supported templating engine.

func GetFileCandidates

func GetFileCandidates(baseName string, extensions ...string) []string

GetFileCandidates returns all possible file names for a base name, including templated variants for each supported template extension.

func RemoveTemplateExt

func RemoveTemplateExt(filename string) string

RemoveTemplateExt strips a recognized template extension (e.g. ".gotpl") from the filename if present.

func ResolveFirstExistingFile

func ResolveFirstExistingFile(root string, candidates ...string) (string, error)

ResolveFirstExistingFile returns the path to the first candidate file that exists under root, or NoFileCandidatesErr if none is found.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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