Skip to content

Commit

Permalink
refactor(binding): use strings.Cut to replace strings.Index (#3522)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgbgbl committed May 7, 2024
1 parent e60113d commit 8dd0889
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions binding/form_mapping.go
Expand Up @@ -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 {
Expand Down

0 comments on commit 8dd0889

Please sign in to comment.