runtime

package
v2.286.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package runtime provides runtime-related helpers used by go-service.

This package contains small utilities such as:

  • Must, which panics on non-nil errors (used for strict startup/config paths),
  • ConvertRecover, which converts recovered panic values into errors, and
  • Version, which reports build info version (or "development").

It also integrates optional runtime configuration such as setting Go's memory limit (see RegisterMemLimit).

Start with `Must`, `ConvertRecover`, `Version`, and `Module`.

Index

Constants

This section is empty.

Variables

View Source
var ErrRecovered = errors.New("recovered")

ErrRecovered is used to wrap panic values converted to an error.

Module wires runtime helpers into Fx.

Functions

func ConvertRecover

func ConvertRecover(value any) error

ConvertRecover converts a recovered panic value into an error wrapped with ErrRecovered.

func Must

func Must(err error)

Must panics if we have an error.

func RegisterMemLimit

func RegisterMemLimit(logger *slog.Logger)

RegisterMemLimit configures Go's memory limit using automemlimit.

This function attempts to set GOMEMLIMIT automatically based on the container/cgroup memory limit. Any returned values and errors are intentionally ignored.

func Version

func Version() string

Version returns the build version of the running binary.

It reads build info via debug.ReadBuildInfo and returns the main module version when available. If build info is unavailable, it returns "development".

Types

This section is empty.

Jump to

Keyboard shortcuts

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