strings.Index
used to cut a string GO-W1008 18 eqIdx := strings.Index(expr, "=")
19 if eqIdx > 0 {
20 tagName := expr[:eqIdx]
21 neqIdx := strings.Index(expr, "!") 22 if neqIdx == -1 {
23 irondbOp = "and"
24 } else {
Using strings.Index
to divide a string using a separator is an antipattern.
Consider using strings.Cut
instead.
idx := strings.Index(str, "@")
if idx == -1 {
return
}
left, right := str[:idx], str[idx+1:]
left, right, ok := strings.Cut(str, "@")
if !ok {
return
}