Skip to content

Commit

Permalink
refactor(substract): use FormatInt function
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusted committed Jul 17, 2021
1 parent 75dba69 commit 27a7eca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package templates
import (
"fmt"
"html/template"
"strconv"
"time"

"github.com/gofiber/template/html"
Expand All @@ -15,7 +16,6 @@ import (

var ext = md.CommonExtensions | md.AutoHeadingIDs


var appConfig = map[string]interface{}{
"copyright": time.Now().Year(),
"appName": config.AppName,
Expand All @@ -27,7 +27,6 @@ var appConfig = map[string]interface{}{
func New() *html.Engine {
engine := html.NewFileSystem(pkger.Dir("/views"), ".html")


engine.AddFunc("config", func(key string) template.HTML {
return template.HTML(fmt.Sprintf("%v", appConfig[key]))
})
Expand Down Expand Up @@ -61,7 +60,7 @@ func New() *html.Engine {
})

engine.AddFunc("subtract", func(a, b int) template.HTML {
return template.HTML(fmt.Sprintf("%d", a-b))
return template.HTML(strconv.FormatInt(int64(a-b), 10))
})

engine.AddFunc("unescape", func(s string) template.HTML {
Expand Down

0 comments on commit 27a7eca

Please sign in to comment.