Skip to content

Commit

Permalink
Ensure template vals are set each time we need them
Browse files Browse the repository at this point in the history
  • Loading branch information
jspc authored Jun 21, 2021
1 parent f0fbd13 commit 2b1304c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 2b1304c

Please sign in to comment.