From 2b1304c03eff85f56e45addb326580cdbc25fd1e Mon Sep 17 00:00:00 2001 From: jspc <810133+jspc@users.noreply.github.com> Date: Tue, 22 Jun 2021 08:14:37 +0900 Subject: [PATCH] Ensure template vals are set each time we need them --- commands.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/commands.go b/commands.go index 948b143..9d91ff3 100644 --- a/commands.go +++ b/commands.go @@ -9,10 +9,6 @@ import ( "github.com/lrstanley/girc" ) -var ( - Vals = TemplateValues{Time: time.Now().In(TZ), Date: time.Now().In(TZ).Format("2006. 01. 02")} -) - type TemplateValues struct { Time time.Time Date string @@ -36,7 +32,7 @@ func (c *Command) Event() (e *girc.Event, err error) { sb := strings.Builder{} - err = tmpl.Execute(&sb, Vals) + err = tmpl.Execute(&sb, TemplateValues{Time: time.Now().In(TZ), Date: time.Now().In(TZ).Format("2006. 01. 02")}) if err != nil { return }