cmd/cloner: preserve nil-valued entries when cloning map (#19749)

The codegen path for map-of-slice-of-pointer fields, skipped
nil-valued entries. That dropped the key from the map.

This broke how dns.Config.Routes uses nil values sentinels.

Fixes #19730
Fixes #19732
Fixes #19746
Fixes #19744

Change-Id: Ic6400227f4ab21b3ca0e8c0eeecf9b83d145a9ab

Signed-off-by: Fernando Serboncini <fserb@tailscale.com>
This commit is contained in:
Fernando Serboncini
2026-05-14 10:30:59 -04:00
committed by GitHub
parent 48919f708b
commit 2a06fb66d0
7 changed files with 105 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ func (src *Config) Clone() *Config {
dst.Routes = map[dnsname.FQDN][]*dnstype.Resolver{}
for k, sv := range src.Routes {
if sv == nil {
dst.Routes[k] = nil
continue
}
dst.Routes[k] = make([]*dnstype.Resolver, len(sv))