http

package
v2.679.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package http provides debug HTTP routing helpers for go-service.

This package provides a small wrapper around go-service's github.com/alexfalkowski/go-service/v2/net/http primitives to build a dedicated debug endpoint router. The root debug package registers its built-in endpoint handlers on the mux returned by NewServeMux.

Routing conventions

Handlers are typically registered using Pattern, which prefixes the provided route pattern with the service name to form a stable debug route namespace.

Start with ServeMux, NewServeMux, and Pattern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pattern added in v2.61.0

func Pattern(name env.Name, pattern string) string

Pattern builds a debug route pattern for name and pattern.

This is a thin wrapper around github.com/alexfalkowski/go-service/v2/net/http.Pattern, which prefixes the provided pattern with the service name to form routes like:

/<name><pattern>

Example:

Pattern(name, "/debug/pprof/") // -> "/my-service/debug/pprof/"

Types

type ServeMux

type ServeMux struct {
	*http.ServeMux
}

ServeMux wraps github.com/alexfalkowski/go-service/v2/net/http.ServeMux for debug routing.

It exists primarily to provide a stable type that can be injected via DI as "the debug mux".

func NewServeMux

func NewServeMux() *ServeMux

NewServeMux constructs a new debug ServeMux.

The returned mux is a small wrapper over go-service's github.com/alexfalkowski/go-service/v2/net/http.ServeMux and is intended as the shared router where debug endpoint packages register their handlers (pprof, fgprof, statsviz, etc.).

Jump to

Keyboard shortcuts

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