File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -283,9 +283,8 @@ func trimSuffix(suffix, s string) string {
283283 return strings .TrimSuffix (s , suffix )
284284}
285285
286- func generateFile (config Config , containers Context ) bool {
287- templatePath := config .Template
288- tmpl , err := template .New (filepath .Base (templatePath )).Funcs (template.FuncMap {
286+ func newTemplate (name string ) * template.Template {
287+ tmpl := template .New (name ).Funcs (template.FuncMap {
289288 "closest" : arrayClosest ,
290289 "coalesce" : coalesce ,
291290 "contains" : contains ,
@@ -312,7 +311,13 @@ func generateFile(config Config, containers Context) bool {
312311 "whereNotExist" : whereNotExist ,
313312 "whereAny" : whereAny ,
314313 "whereAll" : whereAll ,
315- }).ParseFiles (templatePath )
314+ })
315+ return tmpl
316+ }
317+
318+ func generateFile (config Config , containers Context ) bool {
319+ templatePath := config .Template
320+ tmpl , err := newTemplate (filepath .Base (templatePath )).ParseFiles (templatePath )
316321 if err != nil {
317322 log .Fatalf ("unable to parse template: %s" , err )
318323 }
You can’t perform that action at this time.
0 commit comments