You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go1.3.1
FieldsFunc runs over the runes twice. If a closure is used, and the underlying state
does't match the first run, there may be a panic.
The following panics (http://play.golang.org/p/P1MKh8GKaF)
state := false
f := func(c rune) bool {
switch c {
case '1':
fmt.Println(state)
state = !state
return state
default:
fmt.Println("true")
return true
}
}
strings.FieldsFunc(" 1", f)
This should be safe from panics, or at least clearly document that FieldsFunc is run
twice.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: