Documentation
¶
Overview ¶
Package mwchain validates an ordered middleware chain against declared ordering dependencies.
A chain is a slice of specs in execution order (outermost first); each spec may name other specs that MUST be outer to it — the canonical case being a middleware that reads a value another writes via context.WithValue, which is invisible unless the writer runs first. Validate rejects any chain in which a required dependency is positioned inner to (or at the same position as) the spec that needs it, so an accidental reorder fails fast instead of silently mis-wiring the chain (issue #758).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate checks that the chain is internally consistent: names are unique, every Requires target exists, and every required middleware is outer to (has a lower index than) the middleware that depends on it. It returns a named error on the first violation so a reorder is caught deterministically.