From 9cd472c0313b01e71d1f142769c3653058d75c86 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 17 Apr 2024 14:19:14 -0400 Subject: caddyfile: Populate regexp matcher names by default (#6145) * caddyfile: Populate regexp matcher names by default * Some lint cleanup that my VSCode complained about * Pass down matcher name through expression matcher * Compat with #6113: fix adapt test, set both styles in replacer --- context.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'context.go') diff --git a/context.go b/context.go index d73af7702..4307dda88 100644 --- a/context.go +++ b/context.go @@ -556,3 +556,15 @@ func (ctx Context) Module() Module { } return ctx.ancestry[len(ctx.ancestry)-1] } + +// WithValue returns a new context with the given key-value pair. +func (ctx *Context) WithValue(key, value any) Context { + return Context{ + Context: context.WithValue(ctx.Context, key, value), + moduleInstances: ctx.moduleInstances, + cfg: ctx.cfg, + ancestry: ctx.ancestry, + cleanupFuncs: ctx.cleanupFuncs, + exitFuncs: ctx.exitFuncs, + } +} -- cgit v1.2.3