Skip to content

Conversation

@samber
Copy link
Owner

@samber samber commented Jan 27, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 27, 2026 17:50
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.18%. Comparing base (8211383) to head (6ee1841).
⚠️ Report is 1 commits behind head on master.

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           
Flag Coverage Δ
unittests 94.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samber samber merged commit fedd0b6 into master Jan 27, 2026
27 checks passed
@samber samber deleted the doc/explain-inconsistency-chunkstring branch January 27, 2026 17:53
Copy link

Copilot AI left a 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 ChunkString tests 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.

Comment on lines 19 to +21
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."
Copy link

Copilot AI Jan 27, 2026

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.

Copilot uses AI. Check for mistakes.
// 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 [].
Copy link

Copilot AI Jan 27, 2026

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).

Suggested change
// 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.

Copilot uses AI. Check for mistakes.
// 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 [].
Copy link

Copilot AI Jan 27, 2026

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).

Suggested change
// 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).

Copilot uses AI. Check for mistakes.
// []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).
Copy link

Copilot AI Jan 27, 2026

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").

Suggested change
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).

Copilot uses AI. Check for mistakes.
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