refactor: modernize using min()
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user