Documentation
¶
Overview ¶
Package gokit is the module root for github.com/tmoeish/gokit, a batteries-included companion to the Go standard library — the Swiss Army knife that Java calls Guava and JavaScript calls Lodash.
gokit is a collection of small, focused, generics-first packages. Import only the ones you need:
- slicex — generic slice utilities (map/filter/reduce, set ops, chunking)
- mapx — generic map utilities (keys/values, merge, pick/omit, invert)
- setx — a generic hash Set with union/intersection/difference
- strx — string helpers (case conversion, slugify, blank checks, pad)
- mathx — generic math (clamp, gcd/lcm, rounding, primes, safe divide)
- conv — safe any → string/number/bool conversions with explicit errors
- timex — time helpers (begin/end of period, work-days, age, parsing)
- randx — random strings, ints, UUIDs, weighted choice, sampling
- cryptox — hashing (MD5/SHA/HMAC) and base64/hex encoding
- iox — file and I/O helpers (read/write lines, exists, copy, temp)
- jsonx — JSON and YAML marshal/unmarshal, pretty-print, deep clone
- netx — network helpers (local IPs, IP/CIDR validation, free ports)
- ptrx — pointer helpers (Of/Deref, nil-coalescing)
- must — Must/OK/Assert panic-on-error helpers
- retry — context-aware retries with configurable backoff
- syncx — concurrent structures (SafeMap, generic Once, WaitGroupCtx)
- contextx — type-safe context values and request metadata helpers
- logx — structured logging on log/slog with context propagation
- httpx — framework-agnostic HTTP response envelope and error codes
- echox — bridges httpx + contextx into the labstack/echo framework
This root package intentionally exposes no symbols; see the subpackages.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package contextx provides context utilities for attaching and retrieving typed values from a context.Context.
|
Package contextx provides context utilities for attaching and retrieving typed values from a context.Context. |
|
Package conv provides safe type conversion utilities.
|
Package conv provides safe type conversion utilities. |
|
Package cryptox provides cryptographic utility functions.
|
Package cryptox provides cryptographic utility functions. |
|
Package echox bridges gokit's framework-agnostic httpx and contextx packages into the labstack/echo web framework.
|
Package echox bridges gokit's framework-agnostic httpx and contextx packages into the labstack/echo web framework. |
|
Package httpx provides HTTP response types, status codes, and helpers.
|
Package httpx provides HTTP response types, status codes, and helpers. |
|
Package iox provides I/O utility functions.
|
Package iox provides I/O utility functions. |
|
Package jsonx provides JSON and YAML utility functions.
|
Package jsonx provides JSON and YAML utility functions. |
|
Package logx provides structured logging utilities built on top of log/slog.
|
Package logx provides structured logging utilities built on top of log/slog. |
|
Package mapx provides generic map utilities.
|
Package mapx provides generic map utilities. |
|
Package mathx provides generic math utilities.
|
Package mathx provides generic math utilities. |
|
Package must provides must-succeed helpers that panic on error.
|
Package must provides must-succeed helpers that panic on error. |
|
Package netx provides network utility functions.
|
Package netx provides network utility functions. |
|
Package ptrx provides pointer utilities for working with Go generics.
|
Package ptrx provides pointer utilities for working with Go generics. |
|
Package randx provides random utilities.
|
Package randx provides random utilities. |
|
Package retry provides retry utilities with configurable backoff strategies.
|
Package retry provides retry utilities with configurable backoff strategies. |
|
Package setx provides a generic, hash-based Set collection.
|
Package setx provides a generic, hash-based Set collection. |
|
Package slicex provides generic slice utilities.
|
Package slicex provides generic slice utilities. |
|
Package strx provides string utilities.
|
Package strx provides string utilities. |
|
Package syncx provides concurrent data structures and utilities.
|
Package syncx provides concurrent data structures and utilities. |
|
Package timex provides time utilities.
|
Package timex provides time utilities. |