From eef50268a9588bc151dc87228f4e517b5c449572 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 28 Jan 2022 09:08:59 +0100 Subject: [PATCH] refactor(template): rename files --- src/template/func_map.go | 19 +++++++++++++++++++ src/template/{template_func.go => round.go} | 15 --------------- src/template/{template.go => text.go} | 0 .../{template_test.go => text_test.go} | 0 4 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 src/template/func_map.go rename src/template/{template_func.go => round.go} (78%) rename src/template/{template.go => text.go} (100%) rename src/template/{template_test.go => text_test.go} (100%) diff --git a/src/template/func_map.go b/src/template/func_map.go new file mode 100644 index 00000000..f6a786d2 --- /dev/null +++ b/src/template/func_map.go @@ -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) +} diff --git a/src/template/template_func.go b/src/template/round.go similarity index 78% rename from src/template/template_func.go rename to src/template/round.go index 56084e80..09d5c74c 100644 --- a/src/template/template_func.go +++ b/src/template/round.go @@ -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: diff --git a/src/template/template.go b/src/template/text.go similarity index 100% rename from src/template/template.go rename to src/template/text.go diff --git a/src/template/template_test.go b/src/template/text_test.go similarity index 100% rename from src/template/template_test.go rename to src/template/text_test.go