INNER CODE UNIT · Go
resolveTemplate
nicholas-fedor/watchtower · tools/tplprev/main.go:84
func resolveTemplate(arg string) (string, error) {
if tpl, found := templates.Lookup(arg); found {
return tpl, nil
}
contents, err := os.ReadFile(arg)
if err != nil {
return "", fmt.Errorf("read template file: %w", err)
}
return string(contents), nil
}