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

proxy.golang.org : github.com/go-pkgz/ctrl : v0.2.0

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.

Registry - Documentation - Download - JSON - codemeta.json
purl: pkg:golang/github.com/go-pkgz/ctrl@v0.2.0
Published:
Indexed:
Related tag: v0.2.0

    Loading...
    Readme
    Loading...