Modernize Go code

This commit is contained in:
Kovid Goyal
2026-03-10 14:47:41 +05:30
parent 3d13cf1ca5
commit eddaaed3e3
16 changed files with 64 additions and 87 deletions

View File

@@ -69,11 +69,11 @@ func ScanFuncForSeparator(sep string) StringScannerScanFunc {
}
return func(data string) (remaining_data, token string) {
idx := strings.Index(data, sep)
if idx < 0 {
before, after, ok := strings.Cut(data, sep)
if !ok {
return "", data
}
return data[idx+len(sep):], data[:idx]
return after, before
}
}