Skip to content

Commit 6df4fad

Browse files
committed
text/template: fix fisrt for string
1 parent d6117f3 commit 6df4fad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/templates/funcs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ func first(v Slice) (Any, error) {
14701470
if len(s) == 0 {
14711471
return null, nil
14721472
}
1473-
return reflect.ValueOf(s[0]), nil
1473+
return reflect.ValueOf(s[0:1]), nil
14741474
}
14751475
return null, fmt.Errorf("first: expected slice, array or string, got %s", v.Type())
14761476
}

0 commit comments

Comments
 (0)