refactor(binding): use strings.Cut to replace strings.Index (#3522)
This commit is contained in:
parent
e60113dc95
commit
8dd088927a
@ -397,11 +397,8 @@ func setTimeDuration(val string, value reflect.Value) error {
|
||||
}
|
||||
|
||||
func head(str, sep string) (head string, tail string) {
|
||||
idx := strings.Index(str, sep)
|
||||
if idx < 0 {
|
||||
return str, ""
|
||||
}
|
||||
return str[:idx], str[idx+len(sep):]
|
||||
head, tail, _ = strings.Cut(str, sep)
|
||||
return head, tail
|
||||
}
|
||||
|
||||
func setFormMap(ptr any, form map[string][]string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user