Skip to content

Commit 997ce53

Browse files
committed
adapt return type in Add helper function
Signed-off-by: a1012112796 <[email protected]>
1 parent 3df76e7 commit 997ce53

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

modules/templates/helper.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func NewFuncMap() []template.FuncMap {
120120
"Subtract": base.Subtract,
121121
"EntryIcon": base.EntryIcon,
122122
"MigrationIcon": MigrationIcon,
123-
"Add": func(a ...interface{}) int64 {
123+
"Add": func(a ...interface{}) interface{} {
124124
sum := int64(0)
125125

126126
for _, val := range a {
@@ -136,6 +136,15 @@ func NewFuncMap() []template.FuncMap {
136136
}
137137
}
138138

139+
if len(a) > 0 {
140+
switch a[0].(type) {
141+
case int:
142+
return int(sum)
143+
case int32:
144+
return int32(sum)
145+
}
146+
}
147+
139148
return sum
140149
},
141150
"Mul": func(a ...int) int {

0 commit comments

Comments
 (0)