refactor: extract shared token package #46

Merged
mvhutz merged 4 commits from refactor/shared-token-package into main 2026-02-12 00:25:19 +00:00
Showing only changes of commit a230ff9bc7 - Show all commits

View File

@@ -43,12 +43,12 @@ func (i Iterator[T]) Get() (T, error) {
// MustGet is a version of Get, that panics if the datum cannot be returned.
func (i Iterator[T]) MustGet() T {
var null T
if i.Done() {
return null
t, err := i.Get()
if err != nil {
panic(fmt.Errorf("cannot get current token: %w", err))
}
return i.items[i.index]
return t
}
// Forward increments the iterator if the iterator is not yet at the end of the