refactor: modernize using min()

This commit is contained in:
2025-12-16 15:45:51 +01:00
parent 199ac143a4
commit 817205d42f

View File

@@ -32,10 +32,7 @@ func templateFuncMap() template.FuncMap {
if start >= len(s) { if start >= len(s) {
return "" return ""
} }
end := start + length end := min(start+length, len(s))
if end > len(s) {
end = len(s)
}
return s[start:end] return s[start:end]
}, },
"upper": strings.ToUpper, "upper": strings.ToUpper,