-
-
Notifications
You must be signed in to change notification settings - Fork 935
doc: explain chunkstring inconsistency #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #789 +/- ##
=======================================
Coverage 94.18% 94.18%
=======================================
Files 18 18
Lines 2873 2873
=======================================
Hits 2706 2706
Misses 151 151
Partials 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Documents the known inconsistency between ChunkString and Chunk behavior for empty input, linking to the tracking issue.
Changes:
- Add notes in GoDoc (
ChunkString), README, and generated docs pages describing empty-input behavior and linking to #788. - Add inline TODO comments in
ChunkStringtests to capture the desired future behavior. - Add an additional quote line to the docs Community page.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
string.go |
Adds GoDoc note about ChunkString("", n) returning a single empty string element. |
it/string.go |
Adds GoDoc note mirroring the core package behavior for iter sequences. |
string_test.go |
Adds TODO annotation documenting expected future change for empty input. |
it/string_test.go |
Same TODO annotation for the it variant test. |
docs/data/core-chunk.md |
Adds a “Note” section referencing the inconsistency and issue link. |
docs/data/it-chunk.md |
Adds a matching “Note” section for iterator docs. |
README.md |
Adds a note under ChunkString referencing the inconsistency and issue #788. |
docs/src/pages/community.tsx |
Adds an extra quote line to the Community page subtitle. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| These are places where you can ask questions and find your soulmate (no promises). | ||
| <br/> | ||
| "If you want to go fast, go alone. If you want to go far, go together." |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The quote added to the Community page is unrelated to the PR’s stated purpose (documenting ChunkString inconsistency). Please move this change to a separate PR, or update the PR title/description to reflect the additional documentation/UI change.
| // the final chunk will be the remaining characters. | ||
| // Play: https://go.dev/play/p/__FLTuJVz54 | ||
| // | ||
| // Note: lo.ChunkString and lo.Chunk functions behave inconsistently for empty input: lo.ChunkString("", n) returns [""] instead of []. |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GoDoc comment uses ["]" / [] to describe return values, which isn’t valid Go slice syntax and can be confusing in generated documentation. Consider rewording to “returns a slice containing a single empty string” or use Go-style literals like []string{""} vs []string{} (or []T{...} for generics).
| // Note: lo.ChunkString and lo.Chunk functions behave inconsistently for empty input: lo.ChunkString("", n) returns [""] instead of []. | |
| // Note: lo.ChunkString and lo.Chunk functions behave inconsistently for empty input: lo.ChunkString("", n) returns a slice containing a single empty string instead of an empty slice. |
| // the final chunk will be the remaining characters. | ||
| // Play: https://go.dev/play/p/Y4mN8bB2cXw | ||
| // | ||
| // Note: it.ChunkString and it.Chunk functions behave inconsistently for empty input: it.ChunkString("", n) returns [""] instead of []. |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GoDoc comment uses ["]" / [] to describe return values, which isn’t Go syntax and can be confusing for Go users. Consider rewording or using Go-style slice literals (e.g., []string{""} vs []string{} / empty sequence).
| // Note: it.ChunkString and it.Chunk functions behave inconsistently for empty input: it.ChunkString("", n) returns [""] instead of []. | |
| // Note: it.ChunkString and it.Chunk behave inconsistently for empty input: it.ChunkString("", n) yields a single empty string (equivalent to []string{""}) instead of yielding no values (equivalent to an empty slice). |
| // []string{"1"} | ||
| ``` | ||
|
|
||
| Note: `lo.ChunkString` and `lo.Chunk` functions behave inconsistently for empty input: `lo.ChunkString("", n)` returns `[""]` instead of `[]`. See [#788](https://github.com/samber/lo/issues/788). |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This note mixes Go examples (above) with non-Go slice notation ([""] / []). For consistency and clarity in the README, consider using Go-style literals (e.g., []string{""} instead of []string{}) or describe it in words ("slice with one empty string" vs "empty slice").
| Note: `lo.ChunkString` and `lo.Chunk` functions behave inconsistently for empty input: `lo.ChunkString("", n)` returns `[""]` instead of `[]`. See [#788](https://github.com/samber/lo/issues/788). | |
| Note: `lo.ChunkString` and `lo.Chunk` functions behave inconsistently for empty input: `lo.ChunkString("", n)` returns `[]string{""}` instead of `[]string{}` (a slice with one empty string instead of an empty slice). See [#788](https://github.com/samber/lo/issues/788). |
No description provided.