whatisgithub

What is go-linq?

ahmetb/go-linq — explained in plain English

Analysis updated 2026-05-18

3,652GoAudience · developerComplexity · 2/5Setup · easy

In one sentence

go-linq brings .NET-style LINQ query chaining, like filter, sort, and group, to Go collections such as slices, maps, and channels.

Mindmap

mindmap
  root((go-linq))
    What it does
      Filters collections
      Sorts and groups data
      Lazy evaluation
      Method chaining
    Tech stack
      Go
      No dependencies
      Iterator pattern
    Use cases
      Query slices
      Group and count data
      Combine collections
      Replace manual loops
    Audience
      Go developers
      Backend engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Filter and sort a slice of structs without writing manual loops.

USE CASE 2

Group items in a collection and count occurrences, like word frequency.

USE CASE 3

Combine or join two collections using LINQ-style set operations.

USE CASE 4

Iterate over slices, maps, strings, or channels with one consistent API.

What is it built with?

Go

How does it compare?

ahmetb/go-linqesrrhs/pingtunnelcontainersolutions/k8s-deployment-strategies
Stars3,6523,6533,650
LanguageGoGoGo
Setup difficultyeasymoderatemoderate
Complexity2/53/53/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Not stated in the README.

So what is it?

go-linq is a Go library that lets you query and transform collections of data using method chaining, similar to how SQL queries work but written directly in Go code. The concept comes from .NET, where LINQ (Language Integrated Query) lets developers filter, sort, group, and reshape lists of objects using a readable chain of operations instead of writing manual loops. With go-linq, you start from a collection such as a slice, a map, a string, or a channel, then chain operations: filter items with a condition, pick specific fields, sort, group, or combine with other collections. The library uses lazy evaluation, meaning it only processes items as they are consumed rather than building intermediate lists in memory. The library requires no external dependencies and is safe for use across multiple goroutines at the same time. It works with any Go data types through interface parameters, and also offers a set of generic-style methods with a "T" suffix, such as WhereT and SelectT, that accept typed functions for cleaner code. These typed methods use reflection internally and are slower than the standard methods, but they remove the need to write type assertions throughout your code. Version 4 adopted Go's standard iterator pattern, adding typed constructor functions for each collection kind: FromSlice, FromMap, FromChannel, FromString, and more. These avoid the overhead of reflection for common cases. Earlier constructor functions remain available for backward compatibility. The README includes several worked examples: filtering cars by manufacturing year, finding the author who wrote the most books, counting word frequencies across sentences, and implementing a custom query method by extending the library's Query type.

Copy-paste prompts

Prompt 1
Show me how to install go-linq with go get and filter a slice by a condition.
Prompt 2
Help me rewrite this Go for loop using go-linq's Where and Select methods.
Prompt 3
Explain the difference between go-linq's WhereT and Where methods.
Prompt 4
Write a go-linq query that groups items and sorts groups by size.

Frequently asked questions

What is go-linq?

go-linq brings .NET-style LINQ query chaining, like filter, sort, and group, to Go collections such as slices, maps, and channels.

What language is go-linq written in?

Mainly Go. The stack also includes Go.

What license does go-linq use?

Not stated in the README.

How hard is go-linq to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is go-linq for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.