custom license from file

This commit is contained in:
Brad Rydzewski
2017-12-07 16:03:18 -08:00
committed by Jacob McCann
parent 486fb589fd
commit c63d25f5fc
2 changed files with 38 additions and 21 deletions

View File

@@ -36,14 +36,9 @@ type copyrightData struct {
Holder string
}
// prefix will execute a license template l with data d
// prefix will execute a license template t with data d
// and prefix the result with top, middle and bottom.
func prefix(l string, d *copyrightData, top, mid, bot string) ([]byte, error) {
t := licenseTemplate[l]
if t == nil {
return nil, fmt.Errorf("unknown license: %s", l)
}
func prefix(t *template.Template, d *copyrightData, top, mid, bot string) ([]byte, error) {
var buf bytes.Buffer
if err := t.Execute(&buf, d); err != nil {
return nil, err