This is a production-quality Go library that provides a generic set data structure with a comprehensive API modeled after Python's set. It offers two implementations: a thread-unsafe (fast) version backed by a `map[T]struct{}` and a thread-safe version that wraps the unsafe one with a `sync.RWMutex`. The library supports all standard set operations (add, remove, contains, union, intersection, difference, symmetric difference, subset/superset, equality, clone, pop, filter, iteration) and includes JSON and BSON serialization. It uses Go generics (requires Go 1.18+) and provides build-tag-based optimizations for Go 1.21+ (e.g., `maps.Clone`, `Sorted` function). The codebase is clean, well-tested, and benchmarked, with active maintenance and a strong user base including Ethereum, Docker, and 1Password. The architecture is simple and modular: the `Set` interface defines the contract, `threadUnsafeSet` is the core implementation, and `threadSafeSet` adds concurrency safety. The `Iterator` type provides a cancellable channel-based iteration pattern. The `Elements` function offers a Go 1.23-style iterator. The library is a drop-in replacement for any Go project needing a set collection.
This repository provides a generic-based dependency injection framework for Go, called 'kod' (Killer Of Dependency), along with a CLI tool for code generation, component registration, and dependency graph validation. It features a rich interceptor chain for cross-cutting concerns (retry, validation, tracing, rate limiting, circuit breakers, etc.), and includes a comprehensive test suite and examples. The codebase also incorporates an extensive set of AI agent skills for software development workflows (grilling, code review, TDD, domain modeling) from the mattpocock/skills ecosystem. The primary value is the DI framework that leverages Go generics to provide compile-time safety for component wiring, with generated boilerplate code. The architecture is modular with clear separation of core, interceptors, internal utilities, and tests. It is actively maintained with modern Go features.
The chans package is a Go library that provides a set of generic channel operations for building concurrent pipelines. It offers functions for filtering, mapping, reducing, batching, windowing, de-duplication, and routing data through channels. Each function is designed to be composable, allowing developers to construct complex data processing flows by combining these building blocks. The package stands out for its consistent handling of context cancellation across all functions, ensuring that pipelines can be gracefully terminated. A key insight in the implementation is the use of internal helper functions (forEach, whileTrue, untilErr) that abstract the common pattern of iterating over a channel with context awareness. This reduces boilerplate and ensures that every function correctly handles cancellation and channel closure. The Merge function, which fans in multiple input channels using goroutines, is another example of careful concurrency management. Designed to be unopinionated and flexible, chans gives developers full control over channel lifecycle and concurrency patterns. Unlike some other concurrency libraries, it does not impose specific goroutine patterns or error handling strategies, instead providing low-level primitives that can be adapted to various use cases. The package has zero external dependencies beyond the Go standard library, making it easy to integrate into any Go project.