go

module
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT

README

GoDoc Coverage GitHub Stars

go

go

Go standard library extension, adding the missing parts used in the foomo ecosystem to keep DRY.

Features

  • errors — Variadic match helpers (AsAny, AsAnyType, IsAny) wrapping errors.As / errors.Is; Cause unwraps through types.Causer
  • fmt — Template string formatting with %{.key} syntax
  • net — Free port allocation and TCP connection wait helpers (FreePort, FreePorts, WaitFor, WaitForFreePort)
  • options — Generic functional options pattern (Option, OptionE, Builder, BuilderE)
  • os — Typed Getenv/MustGetenv for scalars, slices, and maps with defaults; path Expand (~/, env vars)
  • runtime — Enriched caller introspection (Caller, CallerFunc, CallFrame, StackTrace), per-call-site memoisation (Frame, Memo), and panic recovery
  • sec — Safe path joining to prevent directory traversal (gosec G304)
  • slices — Generic slice utilities: Filter, Map, GroupBy (with error variants)
  • slog — Test-friendly slog.Handler that writes to testing.TB output
  • strings — Case conversions, padding, validation, prefix/suffix matching, and composition
  • testing — Tag-based test filtering via GO_TEST_TAGS, crypto key helpers, ExampleTB
  • time — Context-aware Sleep and polling WaitFor; ParseDuration (adds d/w units); swappable Now clock for deterministic and time-travel tests (Static, Incremental)
  • types — Common interface contracts (Closer, Starter, Stopper, Causer, …) with function adapters and As<X> helpers

How to Contribute

Contributions are welcome! Please read the contributing guide.

Contributors

License

Distributed under MIT License, please read the license file for more details.

Made with ♥ foomo by bestbytes

Directories

Path Synopsis
Package errors provides helpers extending the standard errors package.
Package errors provides helpers extending the standard errors package.
Package fmt provides template-based string formatting utilities extending the standard fmt package.
Package fmt provides template-based string formatting utilities extending the standard fmt package.
internal
sync
Package sync provides a shared pool of reusable bytes.Buffer values.
Package sync provides a shared pool of reusable bytes.Buffer values.
Package net provides network utilities extending the standard net package.
Package net provides network utilities extending the standard net package.
Package options implements the generic functional options pattern: Option and OptionE are functions that configure a value of type T, Apply and ApplyE run a slice of them against a value, and Builder and BuilderE collect options for reuse across multiple Apply calls.
Package options implements the generic functional options pattern: Option and OptionE are functions that configure a value of type T, Apply and ApplyE run a slice of them against a value, and Builder and BuilderE collect options for reuse across multiple Apply calls.
Package os provides typed environment variable lookups with defaults, and path expansion, extending the standard os package.
Package os provides typed environment variable lookups with defaults, and path expansion, extending the standard os package.
Package runtime provides enriched runtime introspection utilities extending the standard runtime package.
Package runtime provides enriched runtime introspection utilities extending the standard runtime package.
Package sec provides security utilities for safe file path handling and directory traversal prevention.
Package sec provides security utilities for safe file path handling and directory traversal prevention.
Package slices provides generic slice utilities extending the standard slices package.
Package slices provides generic slice utilities extending the standard slices package.
Package slog provides structured logging utilities extending the standard log/slog package.
Package slog provides structured logging utilities extending the standard log/slog package.
Package strings provides utility functions for string manipulation and processing.
Package strings provides utility functions for string manipulation and processing.
Package testing provides helpers extending the standard testing package: tag-based test filtering, crypto key generation for tests, free-port allocation, and an ExampleTB for use in Example functions.
Package testing provides helpers extending the standard testing package: tag-based test filtering, crypto key generation for tests, free-port allocation, and an ExampleTB for use in Example functions.
tag
Package tag provides predefined string tags for categorizing tests, consumed by github.com/foomo/go/testing.Tags and github.com/foomo/go/testing.SkipTags.
Package tag provides predefined string tags for categorizing tests, consumed by github.com/foomo/go/testing.Tags and github.com/foomo/go/testing.SkipTags.
Package time provides context-aware time utilities extending the standard time package.
Package time provides context-aware time utilities extending the standard time package.
Package types provides common interface contracts and function adapters used across the foomo ecosystem.
Package types provides common interface contracts and function adapters used across the foomo ecosystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL