An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/go-pkgz/ctrl

Package ctrl provides a set of control functions for assertions, error handling, HTTP server management, and graceful shutdown handling in Go applications. Built for Go 1.21+, it offers a clean API with flexible configuration options and no external runtime dependencies. The package provides assertion functions that panic when conditions are not met, useful for runtime invariant checking: For scenarios where returning an error is more appropriate than panicking, the package provides ErrorOr variants: The package helps manage HTTP server lifecycle, particularly graceful shutdown: The package provides robust handling of process termination signals: Use assertions for internal invariants that should never fail in correct code: Use ErrorOr variants for validating external input or recoverable conditions: For HTTP servers, combine graceful shutdown with server lifecycle management: Example_gracefulShutdown demonstrates basic usage of the GracefulShutdown function. Example_gracefulShutdownCustomConfiguration demonstrates custom shutdown configuration. Example_gracefulShutdownWithCallbacks demonstrates using callbacks during shutdown. Example_httpServerWithContext demonstrates how to run an HTTP server that shuts down gracefully when the parent context is canceled.

Ecosystem
proxy.golang.org
Latest Release
v0.2.0
8 months ago
Versions
2
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/go-pkgz/ctrl
spec
License MIT
Namespace github.com/go-pkgz
First Release about 1 year ago
Last Synced 24 days ago
Repository
Stars 4 on GitHub
Forks 0 on GitHub
Rankings on proxy.golang.org
Overall Top 5.9%