refactor(template): rename files

This commit is contained in:
Jan De Dobbeleer 2022-01-28 09:08:59 +01:00 committed by Jan De Dobbeleer
parent d5c34b58da
commit eef50268a9
4 changed files with 19 additions and 15 deletions

19
src/template/func_map.go Normal file
View file

@ -0,0 +1,19 @@
package template
import (
"text/template"
"github.com/Masterminds/sprig/v3"
)
func funcMap() template.FuncMap {
funcMap := map[string]interface{}{
"secondsRound": secondsRound,
}
for key, fun := range sprig.TxtFuncMap() {
if _, ok := funcMap[key]; !ok {
funcMap[key] = fun
}
}
return template.FuncMap(funcMap)
}

View file

@ -4,23 +4,8 @@ import (
"errors"
"strconv"
"strings"
"text/template"
"github.com/Masterminds/sprig/v3"
)
func funcMap() template.FuncMap {
funcMap := map[string]interface{}{
"secondsRound": secondsRound,
}
for key, fun := range sprig.TxtFuncMap() {
if _, ok := funcMap[key]; !ok {
funcMap[key] = fun
}
}
return template.FuncMap(funcMap)
}
func parseSeconds(seconds interface{}) (int, error) {
switch seconds := seconds.(type) {
default: