Skip to content

Fix FindReaderIndex channel handling, doc example, filename typos; Go 1.24 - #2

Closed
vertoforce wants to merge 1 commit into
masterfrom
cleanup-2026-07
Closed

vertoforce wants to merge 1 commit into
masterfrom
cleanup-2026-07

Conversation

@vertoforce

@vertoforce vertoforce commented Jul 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • FindReaderIndex fixes (streamregexindex.go): the index channel was never closed, so for range over it hung forever. It is now closed when the scanner goroutine finishes, and the doc comment documents that callers must drain both channels (each match sends its index before the match itself, so ignoring the index channel deadlocks the split function).
  • Failing doc example: ExampleFindReaderIndex prints both match and index, but its // Output: comment only listed the match, so go test failed. Corrected to stream of [20 32].
  • Filename typo: steamregexindex.go / steamregexindex_test.go renamed to streamregexindex.go / streamregexindex_test.go via git mv.
  • Modernize: go.mod go directive bumped to 1.24; go mod tidy, gofmt, go vet ./... clean.
  • CI workflow intentionally skipped.

Test results

=== RUN   TestFindReader
--- PASS: TestFindReader (0.00s)
=== RUN   TestFindReaderIndex
--- PASS: TestFindReaderIndex (0.00s)
=== RUN   ExampleFindReader
--- PASS: ExampleFindReader (0.00s)
=== RUN   ExampleFindReaderIndex
--- PASS: ExampleFindReaderIndex (0.00s)
PASS
ok  	github.com/vertoforce/streamregex

Also verified with a temporary regression test that for range over the index channel now terminates (previously hung).

🤖 Generated with Claude Code

…dernize to Go 1.24

- Close the index channel when the scanner goroutine finishes so
  'for range' over it terminates instead of hanging forever; document
  that callers must drain both channels to avoid deadlocking the
  split function.
- Fix ExampleFindReaderIndex's // Output: comment — the example prints
  both match and index ("stream    of [20 32]"), so go test failed.
- Rename steamregexindex(.go|_test.go) -> streamregexindex(.go|_test.go).
- Bump go.mod go directive to 1.24; gofmt/go vet clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vertoforce vertoforce changed the title Fix FindReaderIndex channel handling, doc example, filename typos; Go 1.24 + CI Fix FindReaderIndex channel handling, doc example, filename typos; Go 1.24 Jul 15, 2026
@vertoforce

Copy link
Copy Markdown
Owner Author

Superseded by #3, which includes these same fixes plus the caller-owned-channel + error-returning API redesign. Closing to avoid a conflicting double-merge.

@vertoforce vertoforce closed this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant