Skip to main content

๐Ÿค Contributing

Hey! We are happy to have you as a new contributor. โœŒ๏ธ

For your first contribution please follow some guidelines:

Function Namingโ€‹

Function naming: helpers must be self-explanatory and respect standards (other languages, libraries...). Feel free to suggest many names in your contributions.

Variadic functionsโ€‹

Many functions accept variadic parameters (like lo.Keys(...map[K]V) accepting multiple maps), providing flexibility while maintaining type safety.

Slice type Parametersโ€‹

Functions use ~[]T constraints to accept any slice type, including named slice types, not just []T. This design choice makes the library more flexible in real-world usage.

Variantsโ€‹

When applicable, some functions can be added to sub-package as well: mutable, it and parallel. Add a documentation for each helper.

Testingโ€‹

We try to maintain code coverage above 90%.

Benchmark and performanceโ€‹

Write performant helpers and limit extra memory consumption. Build an helper for general purpose and don't optimize for a particular use-case.

Feel free to write benchmarks.

Iterators can be unbounded and run for a very long time. If you expect a big memory footprint, please warn developers in the function comment.

Documentationโ€‹

Functions must be properly commented, with a Go Playground link. New helpers must be created with a markdown documentation in docs/data/. In markdown header, please link to similar helpers (and update other markdowns accordingly).

Add your helper to docs/static/llms.txt.

Examplesโ€‹

Every function includes a "Play" link to the Go Playground, allowing developers to quickly experiment and understand behavior without setting up a local environment.

Please add an example of your helper in the file named xxxx_example_test.go. It will be available from Godoc website: https://pkg.go.dev/github.com/samber/lo