Golang is an incomplete or empty template

template: "foo" is an incomplete or empty template

funcMap := template.FuncMap{
    "IntToUSD": func(num int) string {
        return decimal.New(int64(num), 2).String()
    },
}

// ...

tmpl, err := template.New(t.file).Funcs(funcMap).ParseFiles(t.files()...)
if err != nil {
    // ...
}

t.files() just returns a slice of strings that are file paths.

Anyone know what’s up?

Make sure the argument you pass to template.New is the base name of one of the files in the list you pass to ParseFiles.

One option is

files := t.files()
if len(files) > 0 {
    name := path.Base(files[0])
    tmpl, err := template.New(name).Funcs(funcMap).ParseFiles(files...)

ParseFiles documentation:

Since the templates created by ParseFiles are named by the base names of the argument files, t should usually have the name of one of the (base) names of the files.