ronantakizawa/codereview-bench huggingface dataset:
Repository: caddyserver/caddy
File: modules/logging/cores.go (Go)

Code before:
package logging

import (
	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
	"go.uber.org/zap/zapcore"
)

func init() {
	caddy.RegisterModule(MockCore{})
}

// MockCore for testing
type MockCore struct {
	zapcore.Core `json:"-"`
}

// CaddyModule returns the Caddy module information.
func (MockCore) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "caddy.logging.cores.mock",
		New: func() caddy.Module { return new(MockCore) },
	}
}

func (lec *MockCore) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// Interface guards
var (
	_ zapcore.Core          = (*MockCore)(nil)
	_ caddy.Module          = (*MockCore)(nil)
	_ caddyfile.Unmarshaler = (*MockCore)(nil)
)


Review comment (suggestion):
These godoc comments end up in https://caddyserver.com/docs/json/ so giving a clearer warning to not use it is a good idea I think.

```suggestion
// MockCore is a no-op module, purely for testing
// during development. Should not be used in apps.
```

Code after:
package logging

import (
	"go.uber.org/zap/zapcore"

	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
)

func init() {
	caddy.RegisterModule(MockCore{})
}

// MockCore is a no-op module, purely for testing
type MockCore struct {
	zapcore.Core `json:"-"`
}

// CaddyModule returns the Caddy module information.
func (MockCore) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "caddy.logging.cores.mock",
		New: func() caddy.Module { return new(MockCore) },
	}
}

func (lec *MockCore) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// Interface guards
var (
	_ zapcore.Core          = (*MockCore)(nil)
	_ caddy.Module          = (*MockCore)(nil)
	_ caddyfile.Unmarshaler = (*MockCore)(nil)
)
Repository: caddyserver/caddy
File: modules/logging/cores.go (Go)

Code before:
package logging

import (
	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
	"go.uber.org/zap/zapcore"
)

func init() {
	caddy.RegisterModule(MockCore{})
}

// MockCore for testing
type MockCore struct {
	zapcore.Core `json:"-"`
}

// CaddyModule returns the Caddy module information.
func (MockCore) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "caddy.logging.cores.mock",
		New: func() caddy.Module { return new(MockCore) },
	}
}

func (lec *MockCore) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// Interface guards
var (

Review comment (suggestion):
I _think_ the linter wants it in this order

```suggestion
	"go.uber.org/zap/zapcore"

	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
```

Code after:
package logging

import (
	"go.uber.org/zap/zapcore"

	"github.com/caddyserver/caddy/v2"
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
)

func init() {
	caddy.RegisterModule(MockCore{})
}

// MockCore is a no-op module, purely for testing
type MockCore struct {
	zapcore.Core `json:"-"`
}

// CaddyModule returns the Caddy module information.
func (MockCore) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "caddy.logging.cores.mock",
		New: func() caddy.Module { return new(MockCore) },
	}
}

func (lec *MockCore) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// Interface guards
Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/selectionpolicies.go (Go)

Code before:

	cookie, err := req.Cookie(s.Name)
	// If there's no cookie, select a host using the fallback policy
	if err != nil || cookie == nil {
		return selectNewHost()
	}
	// If the cookie is present, loop over the available upstreams until we find a match
	cookieValue := cookie.Value
	for _, upstream := range pool {
		if !upstream.Available() {
			continue
		}
		sha, err := hashCookie(s.Secret, upstream.Dial)
		if err == nil && sha == cookieValue {
			return upstream
		}
	}
	// If there is no matching host, select a host using the fallback policy
	return selectNewHost()
}

// UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
//
//	lb_policy cookie [<name> [<secret>]] {
//		fallback <policy>
//		[max_age <duration>]
//	}
//
// `max_age` is a positive (non-zero) `caddy.Duration`
// By default name is `lb`
func (s *CookieHashSelection) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	args := d.RemainingArgs()
	switch len(args) {
	case 1:
	case 2:
		s.Name = args[1]
	case 3:
		s.Name = args[1]
		s.Secret = args[2]
	default:
		return d.ArgErr()
	}
	for d.NextBlock(0) {
		switch d.Val() {
		case "fallback":
			if !d.NextArg() {
				return d.ArgErr()
			}
			if s.FallbackRaw != nil {
				return d.Err("fallback selection policy already specified")
			}

Review comment (suggestion):
All subdirectives are implicitly optional, so the `[]` isn't needed here

```suggestion
//		max_age <duration>
```

Code after:

	cookie, err := req.Cookie(s.Name)
	// If there's no cookie, select a host using the fallback policy
	if err != nil || cookie == nil {
		return selectNewHost()
	}
	// If the cookie is present, loop over the available upstreams until we find a match
	cookieValue := cookie.Value
	for _, upstream := range pool {
		if !upstream.Available() {
			continue
		}
		sha, err := hashCookie(s.Secret, upstream.Dial)
		if err == nil && sha == cookieValue {
			return upstream
		}
	}
	// If there is no matching host, select a host using the fallback policy
	return selectNewHost()
}

// UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
//
//	lb_policy cookie [<name> [<secret>]] {
//		fallback <policy>
//		max_age <duration>
//	}
//
// By default name is `lb`
func (s *CookieHashSelection) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	args := d.RemainingArgs()
	switch len(args) {
	case 1:
	case 2:
		s.Name = args[1]
	case 3:
		s.Name = args[1]
		s.Secret = args[2]
	default:
		return d.ArgErr()
	}
	for d.NextBlock(0) {
		switch d.Val() {
		case "fallback":
			if !d.NextArg() {
				return d.ArgErr()
			}
			if s.FallbackRaw != nil {
				return d.Err("fallback selection policy already specified")
			}
			mod, err := loadFallbackPolicy(d)
Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/selectionpolicies.go (Go)

Code before:
	if err != nil || cookie == nil {
		return selectNewHost()
	}
	// If the cookie is present, loop over the available upstreams until we find a match
	cookieValue := cookie.Value
	for _, upstream := range pool {
		if !upstream.Available() {
			continue
		}
		sha, err := hashCookie(s.Secret, upstream.Dial)
		if err == nil && sha == cookieValue {
			return upstream
		}
	}
	// If there is no matching host, select a host using the fallback policy
	return selectNewHost()
}

// UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
//
//	lb_policy cookie [<name> [<secret>]] {
//		fallback <policy>
//		[max_age <duration>]
//	}
//
// `max_age` is a positive (non-zero) `caddy.Duration`
// By default name is `lb`
func (s *CookieHashSelection) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	args := d.RemainingArgs()
	switch len(args) {
	case 1:
	case 2:
		s.Name = args[1]
	case 3:
		s.Name = args[1]
		s.Secret = args[2]
	default:
		return d.ArgErr()
	}
	for d.NextBlock(0) {
		switch d.Val() {
		case "fallback":
			if !d.NextArg() {
				return d.ArgErr()
			}
			if s.FallbackRaw != nil {
				return d.Err("fallback selection policy already specified")
			}
			mod, err := loadFallbackPolicy(d)
			if err != nil {
				return err

Review comment (suggestion):
I don't think this needs saying tbh, it's implied by the `<duration>`. We'll document it as such in the docs website as well.

```suggestion
```

Code after:
	if err != nil || cookie == nil {
		return selectNewHost()
	}
	// If the cookie is present, loop over the available upstreams until we find a match
	cookieValue := cookie.Value
	for _, upstream := range pool {
		if !upstream.Available() {
			continue
		}
		sha, err := hashCookie(s.Secret, upstream.Dial)
		if err == nil && sha == cookieValue {
			return upstream
		}
	}
	// If there is no matching host, select a host using the fallback policy
	return selectNewHost()
}

// UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
//
//	lb_policy cookie [<name> [<secret>]] {
//		fallback <policy>
//		max_age <duration>
//	}
//
// By default name is `lb`
func (s *CookieHashSelection) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	args := d.RemainingArgs()
	switch len(args) {
	case 1:
	case 2:
		s.Name = args[1]
	case 3:
		s.Name = args[1]
		s.Secret = args[2]
	default:
		return d.ArgErr()
	}
	for d.NextBlock(0) {
		switch d.Val() {
		case "fallback":
			if !d.NextArg() {
				return d.ArgErr()
			}
			if s.FallbackRaw != nil {
				return d.Err("fallback selection policy already specified")
			}
			mod, err := loadFallbackPolicy(d)
			if err != nil {
				return err
			}
Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/caddyfile.go (Go)

Code before:
			}
			h.WriteTimeout = caddy.Duration(timeout)

		case "max_response_header":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid max response header size '%s': %v", d.Val(), err)
			}
			h.MaxResponseHeaderSize = int64(size)

		case "proxy_protocol":
			if !d.NextArg() {
				return d.ArgErr()
			}
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use the 'network_proxy' field instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}

			h.ForwardProxyURL = d.Val()
		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy.source." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)
		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)
			}
			h.DialTimeout = caddy.Duration(dur)

Review comment (suggestion):
```suggestion
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy url <url>' instead.")
```

Code after:
			}
			h.WriteTimeout = caddy.Duration(timeout)

		case "max_response_header":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid max response header size '%s': %v", d.Val(), err)
			}
			h.MaxResponseHeaderSize = int64(size)

		case "proxy_protocol":
			if !d.NextArg() {
				return d.ArgErr()
			}
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy <url>' instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}
			u := network.ProxyFromURL{URL: d.Val()}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(u, "from", "url", nil)

		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)

		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)
Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/caddyfile.go (Go)

Code before:
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use the 'network_proxy' field instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}

			h.ForwardProxyURL = d.Val()
		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy.source." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)
		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)
			}
			h.DialTimeout = caddy.Duration(dur)

		case "dial_fallback_delay":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad fallback delay value '%s': %v", d.Val(), err)
			}
			h.FallbackDelay = caddy.Duration(dur)

		case "response_header_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {

Review comment (suggestion):
```suggestion
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)

```

Code after:
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy <url>' instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}
			u := network.ProxyFromURL{URL: d.Val()}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(u, "from", "url", nil)

		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)

		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)
			}
			h.DialTimeout = caddy.Duration(dur)

		case "dial_fallback_delay":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad fallback delay value '%s': %v", d.Val(), err)
			}
			h.FallbackDelay = caddy.Duration(dur)

		case "response_header_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
Repository: caddyserver/caddy
File: modules/caddyhttp/reverseproxy/caddyfile.go (Go)

Code before:
			}
			h.WriteTimeout = caddy.Duration(timeout)

		case "max_response_header":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid max response header size '%s': %v", d.Val(), err)
			}
			h.MaxResponseHeaderSize = int64(size)

		case "proxy_protocol":
			if !d.NextArg() {
				return d.ArgErr()
			}
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy url <url>' instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}
			u := network.ProxyFromURL{URL: d.Val()}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(u, "from", "url", nil)

		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy.source." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)

		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)

Review comment (suggestion):
```suggestion
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy <url>' instead.")
```

Code after:
			}
			h.WriteTimeout = caddy.Duration(timeout)

		case "max_response_header":
			if !d.NextArg() {
				return d.ArgErr()
			}
			size, err := humanize.ParseBytes(d.Val())
			if err != nil {
				return d.Errf("invalid max response header size '%s': %v", d.Val(), err)
			}
			h.MaxResponseHeaderSize = int64(size)

		case "proxy_protocol":
			if !d.NextArg() {
				return d.ArgErr()
			}
			switch proxyProtocol := d.Val(); proxyProtocol {
			case "v1", "v2":
				h.ProxyProtocol = proxyProtocol
			default:
				return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
			}

		case "forward_proxy_url":
			caddy.Log().Warn("The 'forward_proxy_url' field is deprecated. Use 'network_proxy <url>' instead.")
			if !d.NextArg() {
				return d.ArgErr()
			}
			u := network.ProxyFromURL{URL: d.Val()}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(u, "from", "url", nil)

		case "network_proxy":
			if !d.NextArg() {
				return d.ArgErr()
			}
			modStem := d.Val()
			modID := "caddy.network_proxy." + modStem
			unm, err := caddyfile.UnmarshalModule(d, modID)
			if err != nil {
				return err
			}
			h.NetworkProxyRaw = caddyconfig.JSONModuleObject(unm, "from", modStem, nil)

		case "dial_timeout":
			if !d.NextArg() {
				return d.ArgErr()
			}
			dur, err := caddy.ParseDuration(d.Val())
			if err != nil {
				return d.Errf("bad timeout value '%s': %v", d.Val(), err)
Repository: caddyserver/caddy
File: modules/internal/network/networkproxy.go (Go)

Code before:

// The "none" proxy source module disables the use of network proxy.
type ProxyFromNone struct{}

func (p ProxyFromNone) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID: "caddy.network_proxy.source.none",
		New: func() caddy.Module {
			return &ProxyFromNone{}
		},
	}
}

// UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (p ProxyFromNone) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// ProxyFunc implements ProxyFuncProducer.
func (p ProxyFromNone) ProxyFunc() func(*http.Request) (*url.URL, error) {
	return nil
}

var (
	_ caddy.Module            = ProxyFromURL{}
	_ caddy.Provisioner       = &ProxyFromURL{}
	_ caddy.Validator         = ProxyFromURL{}
	_ caddy.ProxyFuncProducer = ProxyFromURL{}
	_ caddyfile.Unmarshaler   = &ProxyFromURL{}

	_ caddy.Module            = ProxyFromNone{}
	_ caddy.ProxyFuncProducer = ProxyFromNone{}
	_ caddyfile.Unmarshaler   = ProxyFromNone{}
)


Review comment (suggestion):
As for interface guards, `caddy.Module` isn't needed since you call `RegisterModule()`.

I also prefer this pattern to avoid allocations:

```
var _ caddy.Provisioner = (*ProxyFromURL)(nil)
```

Code after:

// The "none" proxy source module disables the use of network proxy.
type ProxyFromNone struct{}

func (p ProxyFromNone) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID: "caddy.network_proxy.none",
		New: func() caddy.Module {
			return &ProxyFromNone{}
		},
	}
}

// UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (p ProxyFromNone) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	return nil
}

// ProxyFunc implements ProxyFuncProducer.
func (p ProxyFromNone) ProxyFunc() func(*http.Request) (*url.URL, error) {
	return nil
}

var (
	_ caddy.Module            = ProxyFromURL{}
	_ caddy.Provisioner       = (*ProxyFromURL)(nil)
	_ caddy.Validator         = ProxyFromURL{}
	_ caddy.ProxyFuncProducer = ProxyFromURL{}
	_ caddyfile.Unmarshaler   = (*ProxyFromURL)(nil)

	_ caddy.Module            = ProxyFromNone{}
	_ caddy.ProxyFuncProducer = ProxyFromNone{}
	_ caddyfile.Unmarshaler   = ProxyFromNone{}
)
Repository: caddyserver/caddy
File: modules/caddyhttp/matchers.go (Go)

Code before:

// MarshalJSON satisfies json.Marshaler by marshaling
// m's raw matcher sets.
func (m MatchNot) MarshalJSON() ([]byte, error) {
	return json.Marshal(m.MatcherSetsRaw)
}

// Provision loads the matcher modules to be negated.
func (m *MatchNot) Provision(ctx caddy.Context) error {
	matcherSets, err := ctx.LoadModule(m, "MatcherSetsRaw")
	if err != nil {
		return fmt.Errorf("loading matcher sets: %v", err)
	}
	for _, modMap := range matcherSets.([]map[string]any) {
		var ms MatcherSet
		for _, modIface := range modMap {
			ms = append(ms, modIface.(RequestMatcher))
		}
		m.MatcherSets = append(m.MatcherSets, ms)
	}
	return nil
}

// Match returns true if r matches m. Since this matcher negates
// the embedded matchers, false is returned if any of its matcher
// sets return true.
func (m MatchNot) Match(r *http.Request) bool {
	for _, ms := range m.MatcherSets {
		if ms.Match(r) {
			return false
		}
	}
	return true
}

// MatchRegexp is an embedable type for matching
// using regular expressions. It adds placeholders
// to the request's replacer.
type MatchRegexp struct {
	// A unique name for this regular expression. Optional,
	// but useful to prevent overwriting captures from other
	// regexp matchers.
	Name string `json:"name,omitempty"`

	// The regular expression to evaluate, in RE2 syntax,
	// which is the same general syntax used by Go, Perl,
	// and Python. For details, see
	// [Go's regexp package](https://golang.org/pkg/regexp/).
	// Captures are accessible via placeholders. Unnamed
	// capture groups are exposed as their numeric, 1-based
	// index, while named capture groups are available by

Review comment (bug):
I'm surprised the CI builds were successful. This should fail at compile-time 🤔 
https://go.dev/play/p/OoO_SNQ5th_0

Code after:
func (m MatchTLS) Match(r *http.Request) bool {
	if r.TLS == nil {
		return false
	}
	if m.HandshakeComplete != nil {
		if (!*m.HandshakeComplete && r.TLS.HandshakeComplete) ||
			(*m.HandshakeComplete && !r.TLS.HandshakeComplete) {
			return false
		}
	}
	return true
}

// UnmarshalCaddyfile parses Caddyfile tokens for this matcher. Syntax:
//
// ... tls [early_data]
//
// EXPERIMENTAL SYNTAX: Subject to change.
func (m *MatchTLS) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	// iterate to merge multiple matchers into one
	for d.Next() {
		if d.NextArg() {
			switch d.Val() {
			case "early_data":
				var false bool
				m.HandshakeComplete = &false
			}
		}
		if d.NextArg() {
			return d.ArgErr()
		}
		if d.NextBlock(0) {
			return d.Err("malformed tls matcher: blocks are not supported yet")
		}
	}
	return nil
}

// CaddyModule returns the Caddy module information.
func (MatchNot) CaddyModule() caddy.ModuleInfo {
	return caddy.ModuleInfo{
		ID:  "http.matchers.not",
		New: func() caddy.Module { return new(MatchNot) },
	}
}

// UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (m *MatchNot) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
	// iterate to merge multiple matchers into one
	for d.Next() {
		matcherSet, err := ParseCaddyfileNestedMatcherSet(d)