go-linq is a language integrated query library for Go that brings LINQ-style capabilities to the language.
The library solves the problem of writing expressive, chainable data transformations in Go without sacrificing type safety or performance. Traditional Go approaches either require verbose loops or resort to runtime type assertions and reflection. go-linq achieves full compile-time type safety by leveraging generic methods, a language feature that allows individual methods to declare their own type parameters. This means type-changing operators like Select, Join, and GroupBy can return queries of different element types while maintaining type information throughout the entire chain. The implementation uses lazy evaluation with an iterator pattern based on the standard iter.Seq[T] type, ensuring that operations are only computed when needed and without per-element allocations.
Developers should choose this tool if they work with Go 1.27 or later and value type safety and readability in data transformation code. It suits projects that perform complex filtering, mapping, grouping, or joining operations on collections. The library works with slices, maps, strings, channels, iter.Seq[T] iterators, and custom collections. For teams still on older Go versions, the project maintains a previous version that offers the same operators but with an any-based API that requires runtime type assertions.
The project demonstrates active maintenance with a comprehensive test suite and performance benchmarks. Development is focused on leveraging modern Go language features to eliminate the type-erasure compromises of earlier versions. The codebase is written in vanilla Go with no external dependencies, and the tool is documented with multiple usage examples covering common patterns like filtering, selection, grouping, and custom method implementation.