mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
Replace strings.Index usages with strings.Cut (#4930)
This commit is contained in:
parent
17ae5acaba
commit
2642bd72b7
8 changed files with 32 additions and 33 deletions
|
@ -324,11 +324,11 @@ func ParseStructTag(tag string) (map[string]string, error) {
|
|||
if pair == "" {
|
||||
continue
|
||||
}
|
||||
parts := strings.SplitN(pair, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
before, after, isCut := strings.Cut(pair, "=")
|
||||
if !isCut {
|
||||
return nil, fmt.Errorf("missing key in '%s' (pair %d)", pair, i)
|
||||
}
|
||||
results[parts[0]] = parts[1]
|
||||
results[before] = after
|
||||
}
|
||||
return results, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue