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
I've been trying to use ArrayEach to parse an array. The callback you can pass takes an error value as its argument and can't return one, meaning that even if you want to stop iterating, you can't. Additionally, the passed error can't be non-nil.
If the error is not nil, we'll run into return offset, e. Since e isn't being reassigned before or after the call to cb, as go does't allow this with type error (value type), the if e != nil { break } is dead code and err will always be nil inside of the callback.
What were the thoughts behind the API design of this function? If I don't understand it, I think comments would be really helpful, both inline and function docs.
The text was updated successfully, but these errors were encountered:
Hey,
I've been trying to use
ArrayEach
to parse an array. The callback you can pass takes anerror
value as its argument and can't return one, meaning that even if you want to stop iterating, you can't. Additionally, the passed error can't be non-nil
.If the error is not
nil
, we'll run intoreturn offset, e
. Sincee
isn't being reassigned before or after the call tocb
, as go does't allow this with typeerror
(value type), theif e != nil { break }
is dead code anderr
will always benil
inside of the callback.What were the thoughts behind the API design of this function? If I don't understand it, I think comments would be really helpful, both inline and function docs.
The text was updated successfully, but these errors were encountered: