From 776b513c444033ed77016fe0e6db332c72ec8079 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Fri, 27 Sep 2024 09:39:20 -0600 Subject: [PATCH] Return correct next state from Read --- gigaparsec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gigaparsec.go b/gigaparsec.go index d96fed0..66cafb9 100644 --- a/gigaparsec.go +++ b/gigaparsec.go @@ -127,8 +127,8 @@ type State[In any] struct { func (s State[In]) Read(dst []In) (n uint64, next State[In], err error) { nread, err := s.r.ReadAt(dst, int64(s.pos)) - if n > 0 { - s.pos += uint64(n) + if nread > 0 { + s.pos += uint64(nread) } return uint64(nread), s, err }