go-service

module
v2.771.0 Latest Latest
Warning

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

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

README ΒΆ

Gopher CircleCI codecov Go Report Card Go Reference

🧰 Go Service

github.com/alexfalkowski/go-service/v2 is an opinionated framework/library for building Go services with consistent wiring for configuration, DI, transports, telemetry, crypto, etc.

This repo is primarily a library of packages (no top-level cmd/ binary). Services built on top typically define their own main package elsewhere and import this module.

Long-running services are expected to start from go-service-template, while short-lived client commands start from go-client-template. Both compose the high-level module bundles from this repository. These are the primary supported paths. Lower-level package-by-package composition is still available, but it is an advanced mode and may require extra manual registration.


πŸš€ Install

For a new long-running service, start from go-service-template so the application main, server command wiring, configuration fixtures, and standard module composition are generated together. For a short-lived control, migration, or batch command, start from go-client-template; it demonstrates cli.Application.AddClient, module.Client, and lifecycle OnStart command work.

For direct package use in an existing module, add the library dependency with the versioned module path:

go get github.com/alexfalkowski/go-service/v2

Use the Go version declared in go.mod or newer when installing or building this module.


🧩 Dependency Injection (Fx)

The framework is designed around dependency injection and uses Uber Fx (and Dig under the hood). Most subsystems expose Fx modules that you compose into your service.

If you are new to Fx, their docs/examples are worth reading first.

Module bundles

The module package exposes three top-level bundles:

  • module.Library for shared foundations (env, compress, encoding, crypto, time, sync buffer-pool wiring, id)
  • module.Server for server processes (Library + config, transports, telemetry, debug, health, etc.)
  • module.Client for short-lived/batch/client processes (Library + config, telemetry, sql, hooks, etc.)

These bundles are the intended default for services generated from go-service-template. They handle the internal registration expected by the framework so most services do not need to wire lower-level transport or lifecycle helpers manually.

Minimal CLI bootstrap example

This repository is a library, so your binary is usually in another module. A typical main uses cli.Application and composes module bundles:

package main

import (
    "github.com/alexfalkowski/go-service/v2/cli"
    "github.com/alexfalkowski/go-service/v2/context"
    "github.com/alexfalkowski/go-service/v2/module"
    "github.com/alexfalkowski/go-service/v2/os"
)

func main() {
    app := cli.NewApplication(func(commander cli.Commander) {
        serve := commander.AddServer("serve", "Run the service", module.Server)
        serve.AddConfig("file:./config.yaml") // adds the `-config` / `-c` config flag with this default
    })

    os.Exit(app.RunCode(context.Background()))
}

The file:./config.yaml default above expects a non-empty config file. A minimal server config can start with the environment plus one enabled transport:

environment: development
transport:
  http:
    address: tcp://localhost:8000
    timeout: 10s

Use app.RunCode(context.Background()) from main when exiting the process. It returns os.ExitCodeSuccess on success, returns a requested non-zero shutdown exit code such as os.ExitCodeServeFailure, and returns os.ExitCodeFailure for other errors. Use app.Run(context.Background()) in tests or embedding code that needs to inspect the returned error.


πŸ–₯️ CLI

Services commonly expose two command shapes:

  • Server: long-running daemon process
  • Client: short-lived control/admin process

The framework uses acmd. Your service’s main typically wires Fx modules + commands.

This repo intentionally does not ship a ready-to-run main β€” it provides the building blocks. In normal usage server applications consume them through go-service-template plus module.Server, while short-lived commands use go-client-template plus module.Client, rather than wiring every subsystem manually.


πŸ—‚οΈ Repository layout

The repo is intentionally split between high-level service composition and lower-level reusable helpers:

  • module/ exposes the opinionated Fx bundles (Library, Server, Client)
  • config/ defines the standard top-level config shape plus projections used by module wiring
  • feature packages such as cache/, crypto/, database/sql/, feature/, telemetry/, time/, and id/ provide config, constructors, and Fx modules for a subsystem
  • net/... contains lower-level protocol helpers and reusable primitives (net/http, net/grpc, metadata/header helpers, gRPC health protocol aliases, and net/server)
  • transport/... contains the higher-level service transport layer: composed HTTP/gRPC stacks, policy middleware, operational endpoints, and transport-specific modules
  • internal/test/ contains the shared test world and fixtures used across packages

As a rule of thumb: if you want protocol primitives or shared helpers, start in net/...; if you want service wiring and middleware policy, start in transport/.... Shared metadata, header, and lifecycle helpers live under net/..., including net/http/meta, net/grpc/meta, net/header, and net/server.Register.

For most service authors, the right starting point is still the high-level module bundles rather than these lower-level packages directly.


βš™οΈ Configuration

Supported config formats

The config decoder supports:

  • JSON
  • HJSON (github.com/hjson/hjson-go/v4)
  • TOML (github.com/BurntSushi/toml)
  • YAML (go.yaml.in/yaml/v3)
Selecting the config source (-config / -c flags)

Config input is routed by flags called -config and -c:

  • file:<path> Read config from a file at <path>; parser is selected from the file extension (.json, .hjson, .yaml, .toml).

  • env:<ENV_VAR> Read config from env var <ENV_VAR>. The env var value must be formatted as:

    "<extension>:<base64-content>"

    Example format: yaml:ZW52aXJvbm1lbnQ6IGRldmVsb3BtZW50Cg==

    Example commands:

    # Linux (GNU base64)
    export SERVICE_CONFIG="yaml:$(base64 -w 0 < ./config.yaml)"
    ./your-service serve -config env:SERVICE_CONFIG
    
    # macOS/BSD base64
    export SERVICE_CONFIG="yaml:$(base64 < ./config.yaml | tr -d '\n')"
    ./your-service serve -c env:SERVICE_CONFIG
    

    HJSON works the same way, for example hjson:<base64-content>.

    The repository helper make kind=configs/config encode-config uses GNU base64 -w 0; on macOS/BSD, use base64 | tr -d '\n' for the equivalent single-line payload.

  • Unsupported explicit kind:location prefixes fail startup instead of falling back to another source.

  • Unprefixed values, including an empty value, fall back to default lookup, searching for:

    <serviceName>.{yaml,hjson,toml,json}

    Default lookup checks extensions first (.yaml, .hjson, .toml, .json), and for each extension checks:

    • executable directory
    • $XDG_CONFIG_HOME/<serviceName>/ (via os.UserConfigDir())
    • /etc/<serviceName>/

[!IMPORTANT] Because the user config directory is part of that search, runtimes using default lookup are expected to provide HOME or XDG_CONFIG_HOME. Services that cannot rely on those environment variables should pass an explicit -config file:<path> or -config env:<ENV_VAR> source.

Typed decoding and validation

At runtime, services typically decode into a struct (often embedding config.Config) and validate it using go-playground/validator.

The library provides a helper config.NewConfig[T] which:

  • decodes into *T
  • rejects an β€œempty” decoded value (guards against starting with a zero-value config)
  • validates the decoded config

Empty detection uses zero-value semantics and supports config types containing maps, slices, or other non-comparable fields.

Example:

type WorkerConfig struct {
    Queue string `yaml:"queue" json:"queue" toml:"queue" validate:"required"`
}

type AppConfig struct {
    Worker         *WorkerConfig `yaml:"worker" json:"worker" toml:"worker" validate:"required"`
    *config.Config `yaml:",inline" json:",inline" toml:",inline" validate:"required"`
}

func loadConfig(decoder config.Decoder, validator *config.Validator) (*AppConfig, error) {
    return config.NewConfig[AppConfig](decoder, validator)
}

func sharedConfig(cfg *AppConfig) *config.Config {
    return cfg.Config
}

func workerConfig(cfg *AppConfig) *WorkerConfig {
    return cfg.Worker
}

var AppConfigModule = di.Module(
    di.Constructor(config.NewConfig[AppConfig]),
    di.Decorate(sharedConfig),
    di.Constructor(workerConfig),
)

Compose AppConfigModule alongside module.Server or module.Client. The decorator projects the embedded shared *config.Config into the standard graph, so the service-specific config is decoded once while existing transport, SQL, and telemetry projections continue to work. Add constructors like workerConfig for service-owned sub-configs.

The standard top-level config shape

The canonical top-level config type is config.Config (in config/config.go). It contains:

  • debug, cache, crypto, feature, hooks, id, sql, telemetry, time, transport, environment

Most sub-configs are optional pointers. Conventionally, nil means disabled.


πŸ” Source strings (secrets, DSNs, paths)

Many fields accept a source string rather than only a literal:

  • env:NAME β†’ read from environment variable NAME (fails if NAME is unset; resolves to an empty value if NAME is explicitly set to "")
  • file:/path/to/thing β†’ read from filesystem after path cleaning; returned bytes are trimmed of leading and trailing whitespace
  • otherwise β†’ treat as literal string

This is used for secrets and key material (TLS keys, HMAC keys, webhook secrets, SQL DSNs, etc). env: values and literal values are returned exactly as provided; they are not trimmed.

Example:

hooks:
  key: current
  secrets:
    current: env:WEBHOOK_SECRET

🌍 Environment

Top-level environment is:

environment: development

This is an env.Environment value used to drive environment-specific behavior in services.


πŸ—œοΈ Compression

Compression kinds used by subsystems that support compression:

  • none
  • zstd
  • s2
  • snappy

🧾 Encoders

Encoding kinds used by subsystems that support encoding. encoding.Map registers each encoder under exactly one canonical kind (no aliases):

  • json
  • hjson
  • toml
  • yaml
  • msgpack
  • protobuf
  • protojson
  • prototext
  • gob
  • bytes

[!NOTE]

  • bytes is the passthrough encoder for io.ReaderFrom/io.WriterTo payloads.
  • HTTP media-type aliases such as pb, proto, protobin, pbbin, pbtxt, prototxt, pbjson, octet-stream, plain, and yml are resolved to the canonical kinds above by net/http/content/unary before they ever reach this registry. See HTTP content types.
  • encoding/stream.Map is a separate registry for streaming (multi-value) encoding β€” json, msgpack, gob, yaml β€” used by HTTP streaming (NDJSON), not by this single-value registry.
  • Not every kind in this registry is interchangeable for HTTP request-body decoding: msgpack and gob remain valid response codecs but are rejected as a request Content-Type. See HTTP content types.

πŸ’Ύ Cache

Cache configuration is defined in cache/config.Config. Built-in driver kinds are redis and ttlcache.

See docs/cache.md for the config shape, driver semantics, size/entry limits, key-namespace implications of compressor/encoder, and Cache.Flush behavior.


🚩 Feature flags (OpenFeature)

feature.Config embeds client-side config (config/client.Config): address, timeout, retry, breaker, limiter, TLS, token, and options. This repository does not construct a built-in OpenFeature provider from this config β€” supply your own openfeature.FeatureProvider and feature.Module registers it with the SDK lifecycle.

See docs/feature-flags.md for a full config example and provider-wiring notes.


πŸͺ Webhooks (Standard Webhooks)

Configured via hooks.Config, using Standard Webhooks signing/verification with key rotation and an optional clock-skew leeway.

See docs/webhooks.md for the config shape, signing/verification behavior, leeway, idempotency guidance, and the CloudEvents structured-encoding requirement.


πŸ†” ID generation

Supported ID kinds:

  • uuid
  • ksuid
  • nanoid
  • ulid
  • xid

Config:

id:
  kind: uuid

[!NOTE] ID generators produce operational identifiers such as request ids, webhook ids, and token jti values. They are not a secret-material API and should not be used as passwords, bearer tokens, or other credentials. Omit id entirely to select the uuid default. If id is present, kind must be one of the supported registered kinds. Sortable kinds such as ksuid, ulid, and xid expose ordering characteristics.


πŸš€ Runtime enhancements

Server commands created through cli.Application.AddServer include runtime.Module, which currently enables:

[!NOTE] This registration is best-effort and does not fail startup if a memory limit cannot be applied. When automemlimit detects an unlimited cgroup and GOMEMLIMIT is not already configured, it sets Go's runtime memory limit to math.MaxInt64, replacing any programmatic limit applied before startup. Direct Fx compositions and client-style commands should include runtime.Module explicitly when they want this behavior.


🐘 SQL (Postgres)

SQL root config is database/sql.Config, with Postgres under sql.pg. module.Server and module.Client both wire PostgreSQL support via database/sql/pg.Module; a nil sql or sql.pg block disables it.

See docs/sql.md for the config shape, reader/writer pool settings, DSN resolution, ping/health-check guidance, and dependencies.


🩺 Health

Health checks are based on go-health and expose Kubernetes-style /<name>/healthz, /<name>/livez, and /<name>/readyz endpoints, plus the standard gRPC grpc.health.v1.Health service when gRPC transport is enabled.

module.Server installs the HTTP/gRPC health transports, but services own the checks and observer mapping β€” see the executable Registrations example.

See docs/health.md for endpoint behavior, checker wiring, and the gRPC health protocol.


πŸ“‘ Telemetry

Telemetry config root is telemetry.Config, covering resource attributes, metadata size limits, propagation formats, and the logger/metrics/tracer signals.

See docs/telemetry.md for the config shape, metadata, propagation, logging (JSON/text/tint/OTLP), metrics (Prometheus/OTLP, histogram buckets), tracing, libraries used, and dependencies.


🎫 Tokens

Token configuration is rooted at token.Config, usually nested under transport.http.token and/or transport.grpc.token. Supported kinds are jwt and paseto, plus a shared Casbin-based access-control layer configured at transport.access.

See docs/tokens.md for Casbin RBAC access control, and the JWT/PASETO config shapes, key rotation, and verification semantics.


🚦 Limiter

Limiter config is transport/limiter.Config, typically applied at transport level. Built-in key kinds are user-id, transport-service-method, service-method, ip, and user-agent.

See docs/limiter.md for the config shape, defaults, key semantics, and response headers/metadata.


πŸ•’ Time (network time)

Time config:

time:
  kind: nts
  address: time.cloudflare.com
  timeout: 2s

Supported kinds:

  • ntp
  • nts

Omit the time block to disable network time. If the block is present, kind must be ntp or nts; empty or unknown kinds fail startup with the time provider not found error. address is provider-specific and is used when the network time provider performs I/O. timeout bounds network operations for the selected provider; a zero value uses the upstream client's default timeout, and negative values are invalid.


🌐 Transport

The transport layer provides higher-level wiring and middleware policy for communication in/out of the service: composed HTTP/gRPC server and client stacks, retries, breakers, token middleware, and health wiring. net/... holds the lower-level protocol primitives those stacks build on.

Supported stacks include gRPC, HTTP REST/RPC abstractions with content negotiation, HTTP MVC helpers, and CloudEvents (transport/http/events).

See docs/transport.md for server configuration and TLS, HTTP content types and streaming (NDJSON), route policy, route-miss and MVC error handling, forwarded-IP/reflection posture, and client-side circuit breakers and retries.


πŸ”‘ Cryptography

The crypto root config is crypto.Config and supports AES, Ed25519, HMAC, and RSA key types. Most fields are source strings.

See docs/crypto.md for the config shape, key format requirements, the crypto.Message encryption API, and dependencies.


πŸ› οΈ Debug endpoints

Debug server config exposes statsviz, pprof, and fgprof under /<name>/debug/..., optionally behind TLS.

See docs/debug.md for the config shape, endpoint paths, and TLS setup.


πŸ§‘β€πŸ’» Development

This repo generally follows the Uber Go Style Guide and uses a bin/ git submodule for make targets; run make help to discover them.

See docs/development.md for repo setup, development dependencies, tests, lint/format, security checks, benchmarks, fuzz tests, coverage reports, code generation, and architecture diagrams.

Directories ΒΆ

Path Synopsis
Package bytes provides byte-oriented helpers used across go-service.
Package bytes provides byte-oriented helpers used across go-service.
Package cache provides cache abstractions, configuration, and drivers for go-service.
Package cache provides cache abstractions, configuration, and drivers for go-service.
config
Package config provides cache configuration types for go-service.
Package config provides cache configuration types for go-service.
driver
Package driver provides cache driver construction and related helpers for go-service.
Package driver provides cache driver construction and related helpers for go-service.
driver/errors
Package errors defines shared sentinel errors and classifiers for cache drivers.
Package errors defines shared sentinel errors and classifiers for cache drivers.
driver/internal/redis
Package redis provides the internal Redis cache driver.
Package redis provides the internal Redis cache driver.
driver/internal/ttlcache
Package ttlcache provides the internal ttlcache-backed cache driver.
Package ttlcache provides the internal ttlcache-backed cache driver.
telemetry
Package telemetry exposes selected Redis OpenTelemetry helpers through the go-service cache import tree.
Package telemetry exposes selected Redis OpenTelemetry helpers through the go-service cache import tree.
Package cli provides helpers for building command-line applications with go-service.
Package cli provides helpers for building command-line applications with go-service.
Package compress provides compression abstractions and DI wiring for go-service.
Package compress provides compression abstractions and DI wiring for go-service.
errors
Package errors provides shared errors for compression packages.
Package errors provides shared errors for compression packages.
none
Package none provides a no-op compression codec for go-service.
Package none provides a no-op compression codec for go-service.
s2
Package s2 provides an S2 compression codec for go-service.
Package s2 provides an S2 compression codec for go-service.
snappy
Package snappy provides a Snappy compression codec for go-service.
Package snappy provides a Snappy compression codec for go-service.
zstd
Package zstd provides a Zstandard (zstd) compression codec for go-service.
Package zstd provides a Zstandard (zstd) compression codec for go-service.
Package config provides configuration decoding, validation, and DI wiring for go-service.
Package config provides configuration decoding, validation, and DI wiring for go-service.
client
Package client provides client-side configuration helpers for go-service.
Package client provides client-side configuration helpers for go-service.
options
Package options provides helpers for working with low-level configuration option key-value pairs.
Package options provides helpers for working with low-level configuration option key-value pairs.
server
Package server provides server-side configuration helpers for go-service.
Package server provides server-side configuration helpers for go-service.
Package context provides small wrappers and aliases around the standard library context package.
Package context provides small wrappers and aliases around the standard library context package.
Package crypto provides cryptographic configuration and DI wiring used by go-service.
Package crypto provides cryptographic configuration and DI wiring used by go-service.
aes
Package aes provides AES-GCM encryption helpers and wiring for go-service.
Package aes provides AES-GCM encryption helpers and wiring for go-service.
bcrypt
Package bcrypt provides bcrypt password hashing helpers for go-service.
Package bcrypt provides bcrypt password hashing helpers for go-service.
ed25519
Package ed25519 provides Ed25519 key generation, signing, and verification helpers for go-service.
Package ed25519 provides Ed25519 key generation, signing, and verification helpers for go-service.
errors
Package errors provides crypto-specific error values shared across go-service crypto helpers.
Package errors provides crypto-specific error values shared across go-service crypto helpers.
hmac
Package hmac provides HMAC signing and verification helpers for go-service.
Package hmac provides HMAC signing and verification helpers for go-service.
message
Package message defines crypto message payloads with authenticated metadata.
Package message defines crypto message payloads with authenticated metadata.
pem
Package pem provides PEM decoding helpers used by go-service.
Package pem provides PEM decoding helpers used by go-service.
rand
Package rand provides cryptographically secure random helpers and wiring for go-service.
Package rand provides cryptographically secure random helpers and wiring for go-service.
rsa
Package rsa provides RSA key loading, encryption, and decryption helpers for go-service.
Package rsa provides RSA key loading, encryption, and decryption helpers for go-service.
tls
Package tls exposes selected standard library crypto/tls types and helpers through the go-service import path.
Package tls exposes selected standard library crypto/tls types and helpers through the go-service import path.
tls/config
Package config defines the go-service TLS configuration model and constructor helpers.
Package config defines the go-service TLS configuration model and constructor helpers.
database
sql
Package sql provides SQL database wiring and helpers for go-service.
Package sql provides SQL database wiring and helpers for go-service.
sql/config
Package config provides shared SQL (github.com/alexfalkowski/go-service/v2/database/sql) configuration types for go-service.
Package config provides shared SQL (github.com/alexfalkowski/go-service/v2/database/sql) configuration types for go-service.
sql/driver
Package driver provides low-level SQL driver registration and connection helpers for go-service.
Package driver provides low-level SQL driver registration and connection helpers for go-service.
sql/pg
Package pg provides PostgreSQL (github.com/alexfalkowski/go-service/v2/database/sql) wiring and helpers for go-service.
Package pg provides PostgreSQL (github.com/alexfalkowski/go-service/v2/database/sql) wiring and helpers for go-service.
sql/telemetry
Package telemetry exposes selected github.com/XSAM/otelsql helpers through the go-service SQL import tree.
Package telemetry exposes selected github.com/XSAM/otelsql helpers through the go-service SQL import tree.
Package debug provides debug server wiring and diagnostic endpoints for go-service.
Package debug provides debug server wiring and diagnostic endpoints for go-service.
http
Package http provides debug HTTP routing helpers for go-service.
Package http provides debug HTTP routing helpers for go-service.
internal/fgprof
Package fgprof provides Fx wiring to expose fgprof profiling over HTTP.
Package fgprof provides Fx wiring to expose fgprof profiling over HTTP.
internal/pprof
Package pprof provides Fx wiring to expose net/http/pprof profiling endpoints.
Package pprof provides Fx wiring to expose net/http/pprof profiling endpoints.
internal/statsviz
Package statsviz provides Fx wiring to expose statsviz diagnostics over HTTP.
Package statsviz provides Fx wiring to expose statsviz diagnostics over HTTP.
Package di provides small wrappers around Uber Fx/Dig to standardize dependency injection wiring.
Package di provides small wrappers around Uber Fx/Dig to standardize dependency injection wiring.
Package encoding provides value encoding/decoding helpers and DI wiring used by go-service.
Package encoding provides value encoding/decoding helpers and DI wiring used by go-service.
base64
Package base64 provides encoding helpers and adapters used by go-service.
Package base64 provides encoding helpers and adapters used by go-service.
bytes
Package bytes provides byte-oriented encoding helpers and adapters used by go-service.
Package bytes provides byte-oriented encoding helpers and adapters used by go-service.
codec
Package codec defines the common contract implemented by supported encodings.
Package codec defines the common contract implemented by supported encodings.
errors
Package errors provides encoding error values and helpers used by go-service.
Package errors provides encoding error values and helpers used by go-service.
gob
Package gob provides Gob encoding helpers and adapters used by go-service.
Package gob provides Gob encoding helpers and adapters used by go-service.
hjson
Package hjson provides HJSON encoding helpers and adapters used by go-service.
Package hjson provides HJSON encoding helpers and adapters used by go-service.
json
Package json provides the go-service JSON import path.
Package json provides the go-service JSON import path.
msgpack
Package msgpack provides MessagePack encoding helpers and adapters used by go-service.
Package msgpack provides MessagePack encoding helpers and adapters used by go-service.
proto
Package proto provides Protocol Buffers (protobuf) encoding helpers and adapters used by go-service.
Package proto provides Protocol Buffers (protobuf) encoding helpers and adapters used by go-service.
stream
Package stream provides streaming (multi-value) encode/decode interfaces used by go-service.
Package stream provides streaming (multi-value) encode/decode interfaces used by go-service.
stream/gob
Package gob provides a streaming gob github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
Package gob provides a streaming gob github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
stream/json
Package json provides a streaming JSON github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
Package json provides a streaming JSON github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
stream/msgpack
Package msgpack provides a streaming MessagePack github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
Package msgpack provides a streaming MessagePack github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
stream/yaml
Package yaml provides a streaming YAML github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
Package yaml provides a streaming YAML github.com/alexfalkowski/go-service/v2/encoding/stream.Encoder/ github.com/alexfalkowski/go-service/v2/encoding/stream.Decoder pair used by go-service.
toml
Package toml provides TOML encoding helpers and adapters used by go-service.
Package toml provides TOML encoding helpers and adapters used by go-service.
yaml
Package yaml provides YAML encoding helpers and adapters used by go-service.
Package yaml provides YAML encoding helpers and adapters used by go-service.
Package env provides service identity values derived from environment variables and defaults.
Package env provides service identity values derived from environment variables and defaults.
Package errors provides small error helpers used across go-service.
Package errors provides small error helpers used across go-service.
Package feature provides OpenFeature wiring and helpers for go-service.
Package feature provides OpenFeature wiring and helpers for go-service.
Package flag provides helpers for defining and parsing command-line flags in go-service.
Package flag provides helpers for defining and parsing command-line flags in go-service.
Package health provides health server wiring for go-service.
Package health provides health server wiring for go-service.
checker
Package checker provides health check implementations used by go-service.
Package checker provides health check implementations used by go-service.
Package hooks provides shared Standard Webhooks construction helpers and wiring for go-service.
Package hooks provides shared Standard Webhooks construction helpers and wiring for go-service.
id
Package id provides ID generation abstractions, registries, and wiring used by go-service.
Package id provides ID generation abstractions, registries, and wiring used by go-service.
ksuid
Package ksuid provides KSUID-based ID generation helpers used by go-service.
Package ksuid provides KSUID-based ID generation helpers used by go-service.
nanoid
Package nanoid provides NanoID-based ID generation helpers used by go-service.
Package nanoid provides NanoID-based ID generation helpers used by go-service.
ulid
Package ulid provides ULID-based ID generation helpers used by go-service.
Package ulid provides ULID-based ID generation helpers used by go-service.
uuid
Package uuid provides UUID-based ID generation helpers used by go-service.
Package uuid provides UUID-based ID generation helpers used by go-service.
xid
Package xid provides XID-based ID generation helpers used by go-service.
Package xid provides XID-based ID generation helpers used by go-service.
internal
test
Package test provides shared fixtures, configuration builders, and in-memory wiring helpers used by integration-style tests across the repository.
Package test provides shared fixtures, configuration builders, and in-memory wiring helpers used by integration-style tests across the repository.
test/greet/v1
Package v1 contains generated protobuf and gRPC test fixtures used by go-service tests.
Package v1 contains generated protobuf and gRPC test fixtures used by go-service tests.
Package io provides small wrappers and helpers around the standard library io package.
Package io provides small wrappers and helpers around the standard library io package.
Package meta provides context-scoped metadata storage and helpers for go-service.
Package meta provides context-scoped metadata storage and helpers for go-service.
Package module provides top-level Fx module composition for go-service.
Package module provides top-level Fx module composition for go-service.
net
Package net provides small network helpers and wrappers used by go-service.
Package net provides small network helpers and wrappers used by go-service.
grpc
Package grpc provides the go-service gRPC import path.
Package grpc provides the go-service gRPC import path.
grpc/codes
Package codes provides go-service aliases for gRPC status codes.
Package codes provides go-service aliases for gRPC status codes.
grpc/config
Package config contains gRPC transport configuration types used by go-service.
Package config contains gRPC transport configuration types used by go-service.
grpc/errors
Package errors provides gRPC-specific error helpers for go-service.
Package errors provides gRPC-specific error helpers for go-service.
grpc/health
Package health provides go-service aliases for the standard gRPC health protocol.
Package health provides go-service aliases for the standard gRPC health protocol.
grpc/meta
Package meta provides the go-service gRPC metadata import path.
Package meta provides the go-service gRPC metadata import path.
grpc/method
Package method defines gRPC method policy helpers.
Package method defines gRPC method policy helpers.
grpc/server
Package server provides helpers for running a gRPC server as a managed go-service server.
Package server provides helpers for running a gRPC server as a managed go-service server.
grpc/status
Package status provides helpers for constructing and inspecting gRPC status errors while using go-service types.
Package status provides helpers for constructing and inspecting gRPC status errors while using go-service types.
grpc/telemetry
Package telemetry provides minimal, stable helpers for wiring OpenTelemetry instrumentation into gRPC clients and servers using gRPC stats handlers.
Package telemetry provides minimal, stable helpers for wiring OpenTelemetry instrumentation into gRPC clients and servers using gRPC stats handlers.
header
Package header provides shared helpers for working with network protocol headers in go-service.
Package header provides shared helpers for working with network protocol headers in go-service.
http
Package http provides small HTTP wrappers and helpers around the standard library net/http package.
Package http provides small HTTP wrappers and helpers around the standard library net/http package.
http/body
Package body provides request-body handling helpers for HTTP handlers.
Package body provides request-body handling helpers for HTTP handlers.
http/client
Package client provides a content-aware HTTP client wrapper used by go-service.
Package client provides a content-aware HTTP client wrapper used by go-service.
http/compress
Package compress provides zstd and gzip HTTP handler and transport wrappers.
Package compress provides zstd and gzip HTTP handler and transport wrappers.
http/config
Package config contains HTTP transport configuration types used by go-service.
Package config contains HTTP transport configuration types used by go-service.
http/content/policy
Package policy classifies HTTP content codecs for untrusted request decoding.
Package policy classifies HTTP content codecs for untrusted request decoding.
http/content/stream
Package stream provides NDJSON HTTP request and response streaming on top of content codecs.
Package stream provides NDJSON HTTP request and response streaming on top of content codecs.
http/content/unary
Package unary provides HTTP content negotiation and single-value handlers used by go-service.
Package unary provides HTTP content negotiation and single-value handlers used by go-service.
http/errors
Package errors provides HTTP-specific error helpers for go-service.
Package errors provides HTTP-specific error helpers for go-service.
http/events
Package events provides CloudEvents HTTP helpers behind the go-service import path.
Package events provides CloudEvents HTTP helpers behind the go-service import path.
http/media
Package media defines common HTTP media type constants used by go-service.
Package media defines common HTTP media type constants used by go-service.
http/meta
Package meta provides HTTP-specific context metadata helpers and middleware for go-service.
Package meta provides HTTP-specific context metadata helpers and middleware for go-service.
http/mvc
Package mvc provides a small MVC-style HTML rendering layer for go-service HTTP servers.
Package mvc provides a small MVC-style HTML rendering layer for go-service HTTP servers.
http/quota
Package quota provides a per-value byte quota for a stream decoder, shared by the HTTP server's bidirectional streaming request path (github.com/alexfalkowski/go-service/v2/net/http/content/stream.RequestStream.Recv) and the HTTP client's streaming response path (github.com/alexfalkowski/go-service/v2/net/http/client.ResponseStream.Recv).
Package quota provides a per-value byte quota for a stream decoder, shared by the HTTP server's bidirectional streaming request path (github.com/alexfalkowski/go-service/v2/net/http/content/stream.RequestStream.Recv) and the HTTP client's streaming response path (github.com/alexfalkowski/go-service/v2/net/http/client.ResponseStream.Recv).
http/rest
Package rest provides REST-style HTTP handler registration and client helpers for go-service.
Package rest provides REST-style HTTP handler registration and client helpers for go-service.
http/rpc
Package rpc provides RPC-style HTTP handler registration and client helpers for go-service.
Package rpc provides RPC-style HTTP handler registration and client helpers for go-service.
http/server
Package server provides HTTP server adapters and lifecycle wiring for go-service.
Package server provides HTTP server adapters and lifecycle wiring for go-service.
http/status
Package status provides helpers for working with HTTP status codes and status errors in go-service.
Package status provides helpers for working with HTTP status codes and status errors in go-service.
http/telemetry
Package telemetry provides minimal, stable helpers for wiring OpenTelemetry instrumentation into net/http clients and servers.
Package telemetry provides minimal, stable helpers for wiring OpenTelemetry instrumentation into net/http clients and servers.
server
Package server provides transport-agnostic server lifecycle helpers used by go-service.
Package server provides transport-agnostic server lifecycle helpers used by go-service.
url
Package url provides URL helpers used by go-service network packages.
Package url provides URL helpers used by go-service network packages.
Package os provides OS and filesystem helpers used throughout go-service.
Package os provides OS and filesystem helpers used throughout go-service.
Package ptr provides small, generic helpers for working with pointers.
Package ptr provides small, generic helpers for working with pointers.
Package reflect provides small reflection helpers for go-service.
Package reflect provides small reflection helpers for go-service.
Package retry provides shared retry helpers for go-service.
Package retry provides shared retry helpers for go-service.
Package runtime provides small runtime-oriented helpers used by go-service.
Package runtime provides small runtime-oriented helpers used by go-service.
Package slices provides small, generic helpers for working with slices.
Package slices provides small, generic helpers for working with slices.
Package strings provides small string helpers and a curated set of aliases for the Go standard library strings package.
Package strings provides small string helpers and a curated set of aliases for the Go standard library strings package.
Package sync wires the shared buffer pool used by go-service.
Package sync wires the shared buffer pool used by go-service.
Package telemetry provides OpenTelemetry-based telemetry configuration and wiring for go-service.
Package telemetry provides OpenTelemetry-based telemetry configuration and wiring for go-service.
attributes
Package attributes provides small, stable helpers and aliases for OpenTelemetry semantic convention attributes used by go-service.
Package attributes provides small, stable helpers and aliases for OpenTelemetry semantic convention attributes used by go-service.
errors
Package errors wires OpenTelemetry global error handling into an independent stdout diagnostic sink.
Package errors wires OpenTelemetry global error handling into an independent stdout diagnostic sink.
header
Package header provides helpers for configuring telemetry exporter/request headers.
Package header provides helpers for configuring telemetry exporter/request headers.
logger
Package logger provides structured logging helpers and wiring for go-service.
Package logger provides structured logging helpers and wiring for go-service.
metrics
Package metrics wires OpenTelemetry metrics into a go-service application.
Package metrics wires OpenTelemetry metrics into a go-service application.
otlp
Package otlp validates shared OpenTelemetry Protocol exporter configuration.
Package otlp validates shared OpenTelemetry Protocol exporter configuration.
tracer
Package tracer wires OpenTelemetry tracing into a go-service application.
Package tracer wires OpenTelemetry tracing into a go-service application.
Package time provides time-related helpers, aliases, and optional network time providers used by go-service.
Package time provides time-related helpers, aliases, and optional network time providers used by go-service.
Package token provides token generation and verification helpers used by go-service.
Package token provides token generation and verification helpers used by go-service.
access
Package access provides authorization (access control) helpers used by go-service.
Package access provides authorization (access control) helpers used by go-service.
errors
Package errors defines shared sentinel errors used by go-service token implementations.
Package errors defines shared sentinel errors used by go-service token implementations.
jwt
Package jwt provides JSON Web Token (JWT) issuance and verification for go-service.
Package jwt provides JSON Web Token (JWT) issuance and verification for go-service.
keys
Package keys provides token key configuration helpers.
Package keys provides token key configuration helpers.
paseto
Package paseto provides PASETO token generation and verification for go-service.
Package paseto provides PASETO token generation and verification for go-service.
Package transport provides higher-level transport wiring for services built with go-service.
Package transport provides higher-level transport wiring for services built with go-service.
breaker
Package breaker provides circuit breaker helpers and defaults used by go-service.
Package breaker provides circuit breaker helpers and defaults used by go-service.
grpc
Package grpc contains gRPC transport wiring for services built with go-service.
Package grpc contains gRPC transport wiring for services built with go-service.
grpc/breaker
Package breaker provides gRPC client-side circuit breaking for go-service.
Package breaker provides gRPC client-side circuit breaking for go-service.
grpc/health
Package health provides gRPC health protocol wiring for go-service.
Package health provides gRPC health protocol wiring for go-service.
grpc/limiter
Package limiter provides gRPC rate limiter interceptors and wiring for go-service.
Package limiter provides gRPC rate limiter interceptors and wiring for go-service.
grpc/recovery
Package recovery provides gRPC server interceptors that turn panics into application errors.
Package recovery provides gRPC server interceptors that turn panics into application errors.
grpc/retry
Package retry provides gRPC retry interceptors and wiring for go-service.
Package retry provides gRPC retry interceptors and wiring for go-service.
grpc/telemetry/logger
Package logger provides gRPC logging interceptors and wiring for go-service.
Package logger provides gRPC logging interceptors and wiring for go-service.
grpc/token
Package token provides gRPC token interceptors and wiring for go-service.
Package token provides gRPC token interceptors and wiring for go-service.
http
Package http provides HTTP transport wiring for services built with go-service.
Package http provides HTTP transport wiring for services built with go-service.
http/body
Package body provides HTTP request body size-limit middleware.
Package body provides HTTP request body size-limit middleware.
http/breaker
Package breaker provides HTTP client-side circuit breaking for go-service.
Package breaker provides HTTP client-side circuit breaking for go-service.
http/events
Package events provides CloudEvents HTTP sender/receiver wiring for go-service.
Package events provides CloudEvents HTTP sender/receiver wiring for go-service.
http/events/hooks
Package hooks provides CloudEvents-specific HTTP webhook middleware for go-service.
Package hooks provides CloudEvents-specific HTTP webhook middleware for go-service.
http/health
Package health provides HTTP health transport wiring for go-service.
Package health provides HTTP health transport wiring for go-service.
http/hooks
Package hooks provides HTTP webhook middleware and wiring for go-service.
Package hooks provides HTTP webhook middleware and wiring for go-service.
http/limiter
Package limiter provides HTTP rate limiter middleware and wiring for go-service.
Package limiter provides HTTP rate limiter middleware and wiring for go-service.
http/retry
Package retry provides HTTP retry middleware for go-service clients.
Package retry provides HTTP retry middleware for go-service clients.
http/telemetry/logger
Package logger provides HTTP logging middleware and wiring for go-service.
Package logger provides HTTP logging middleware and wiring for go-service.
http/telemetry/metrics
Package metrics provides HTTP metrics endpoint wiring for go-service.
Package metrics provides HTTP metrics endpoint wiring for go-service.
http/token
Package token provides HTTP token middleware and wiring for go-service.
Package token provides HTTP token middleware and wiring for go-service.
limiter
Package limiter provides in-memory rate limiting primitives used by go-service.
Package limiter provides in-memory rate limiting primitives used by go-service.
retry
Package retry provides shared retry configuration used across go-service transports.
Package retry provides shared retry configuration used across go-service transports.

Jump to

Keyboard shortcuts

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