Commit graph

6 commits

Author SHA1 Message Date
a1943556b4
fix: add explicit panic for Max/Min on empty slices
Adds length checks to Max and Min functions to provide clear,
explicit panic messages when called with empty slices, rather
than allowing confusing index-out-of-bounds panics.

Changes:
- Max: Added check for empty slice with "underscore.Max: empty slice" panic
- Min: Added check for empty slice with "underscore.Min: empty slice" panic
- Updated doc comments to document panic behavior
- Added TestMaxEmpty and TestMinEmpty to verify panic behavior

Impact:
- Better error messages for debugging
- Documented behavior prevents user surprises
- Non-breaking change (still panics, just with clearer message)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 13:51:35 +01:00
c53d46816f
refactor: migrate to Go 1.22 slices/cmp, update linters
Replace usage of golang.org/x/exp/constraints with Go 1.22 cmp/slices.
Update .golangci.yml to new v2 format and enable gofmt/goimports.
Refactor imports and type constraints across codebase for consistency.
2025-09-01 23:08:10 -04:00
Ruidy
3bfe1aca18
Code coverage (#15)
* 👷 adding test and push coverage

* ⬆️ use official Go 1.18 image

Co-authored-by: Ruidy <rnemausat@newstore.com>
2022-03-18 18:22:01 +01:00
Ruidy
7ddb05602c refactor: use contraints 2022-01-01 14:21:05 -04:00
Ruidy
b26a360495 feat: min 2021-12-29 22:35:39 -04:00
Ruidy
eddfb60d44 feat: max 2021-12-29 22:30:57 -04:00