fix fbs encoding

This commit is contained in:
Aleksandr Trushkin
2024-02-11 20:13:23 +03:00
parent a94cbe6710
commit 23a4f007fc
2 changed files with 14 additions and 6 deletions

View File

@ -545,6 +545,8 @@ type chanIter[T any] struct {
next T
}
var errChannelClosed = errors.New("channel closed")
func (i *chanIter[T]) Next() (ok bool) {
if i.err != nil {
return false
@ -552,7 +554,7 @@ func (i *chanIter[T]) Next() (ok bool) {
i.next, ok = <-i.in
if !ok {
i.err = errors.New("channel closed")
i.err = errChannelClosed
}
return ok
@ -563,6 +565,10 @@ func (i *chanIter[T]) Get() T {
}
func (i *chanIter[T]) Err() error {
if errors.Is(i.err, errChannelClosed) {
return nil
}
return i.err
}