From 55806bb24d2e40c5c9763fdcf1614e826a0ab6d0 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 11 Dec 2023 12:31:32 +0000 Subject: [PATCH] fix: iterable.From --- core/iterable/iterable.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/iterable/iterable.go b/core/iterable/iterable.go index d413d90..b7fb165 100644 --- a/core/iterable/iterable.go +++ b/core/iterable/iterable.go @@ -26,8 +26,9 @@ func From[T any](slice []T) Iterator[T] { i := 0 return NewIterator(func() (T, error) { if i < len(slice) { + item := slice[i] i++ - return slice[i], nil + return item, nil } var undef T return undef, io.EOF