go-snk
The kitchen sink utility library for Go. Type-safe generic helpers that replace the repetitive loops and boilerplate you keep rewriting across every project.
// filter and transform in one pass
active := slicex.Filter(users, func(u User) bool {
return u.Active
})
// safe pointer dereferencing with a fallback
name := helpers.AsValueOr(user.Name, "anonymous")
// typed HTTP responses with no boilerplate
resp, err := httpx.Get[MyType](ctx, url)
Install with a single command
go get github.com/SharkByteSoftware/go-snk
Everything you keep reaching for
Each package is narrow in scope so you adopt only what you need. Every helper is generic, type-safe, and easy to test.
slicex
docs →Generic helpers for filtering, mapping, reducing, grouping, deduplicating, partitioning, zipping, and numeric aggregation. Replaces the slice loops you write over and over.
slicex/parallel
docs →Parallel versions of selected slicex helpers for workloads where each item can be processed independently. Results are always returned in input order. Concurrency limits supported.
mapx
docs →Generic helpers for extracting, filtering, transforming, merging, inverting, and counting map entries. Replaces the map loops you write everywhere.
httpx
docs →Lightweight HTTP client helpers with typed response decoding, sentinel errors, and raw response access. No more boilerplate for every outbound request.
jsonx
docs →Encode and decode JSON from readers, byte slices, and strings with consistent option handling. Covers strict decoding, number handling, HTML escaping, and indentation.
containers
docs →Generic collection types — doubly linked lists, sets with full algebra support, stacks, and double-ended queues. All with a clean, consistent API.
stringx
docs →Small helpers for blank checks, fallback selection, Unicode-safe truncation, wrapping, and padding. More expressive than reaching for strings directly every time.
And more
errorx
Intentional error suppression, must-succeed initialization panics, multi-target matching, and first-error reduction.
helpers
Pointer utilities — AsPtr, AsValueOr, IsNil — and zero-value construction for generic code.
conditional
Concise branching helpers — If, IfNotNil, IfCallReturn — for readable conditional expressions.
Adopt only what you need
Every package is narrow in scope and independent. Pull in slicex without containers, or httpx without anything else. No forced coupling.
Type-safe generics throughout
No interface{}, no runtime casting. Every helper uses Go generics so your compiler catches misuse before you do.
Consistent patterns
Every package follows the same conventions. Once you know one, you know them all. Code that reads clearly and tests easily.
Clean up your Go projects
Stop copying utility functions between projects. Add go-snk and keep your codebase clean.