mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
The callsite is recorded by counting frames out to the programmer's line, and a verb method on a scope sits one frame further away than the package-level function does. The count said otherwise, so every conflict, cycle and post-seal write in a scoped service cited a line somewhere above the registration instead of the two lines actually in conflict. Two tests now hold both halves of that attribution — the package an op is filed under and the line it names — across all three forms a registration takes, including a handler another package composed, which is the shape that once published seven ops with no description at all. Co-authored-by: Hanzo Dev <[email protected]>
20 lines
643 B
Go
20 lines
643 B
Go
// Package meter composes handlers somewhere other than where they are
|
|
// registered, which is the shape that decides whether an op's prose is found.
|
|
package meter
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
// Paid wraps fn in a closure DECLARED HERE, so the handler's package and the
|
|
// registering package disagree — the disagreement [zip.Op].Pkg has to resolve
|
|
// in the registrar's favour, since the registrar is the source zipdoc read the
|
|
// doc comments from.
|
|
func Paid[In, Out any](fn zip.TypedHandler[In, Out]) zip.TypedHandler[In, Out] {
|
|
return func(ctx context.Context, in *In) (*Out, error) {
|
|
return fn(ctx, in)
|
|
}
|
|
}
|