Use maps.Copy for simpler map handling (#7009)

Signed-off-by: eveneast <qcqs@foxmail.com>
This commit is contained in:
eveneast 2025-05-14 05:16:47 +08:00 committed by GitHub
parent 8524386737
commit a76d005a94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 18 deletions

View file

@ -16,6 +16,7 @@ package httpcaddyfile
import (
"encoding/json"
"maps"
"net"
"slices"
"sort"
@ -365,9 +366,7 @@ func parseSegmentAsConfig(h Helper) ([]ConfigValue, error) {
// copy existing matcher definitions so we can augment
// new ones that are defined only in this scope
matcherDefs := make(map[string]caddy.ModuleMap, len(h.matcherDefs))
for key, val := range h.matcherDefs {
matcherDefs[key] = val
}
maps.Copy(matcherDefs, h.matcherDefs)
// find and extract any embedded matcher definitions in this scope
for i := 0; i < len(segments); i++ {