From 81eba2777a3d384d42e789b0317976fb9edc7158 Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 18 Mar 2026 01:02:48 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20apply=20Gemini=20Pro=20review=20?= =?UTF-8?q?=E2=80=94=20maps.Clone=20for=20crash=20metadata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents external mutation of crash handler metadata after construction. Uses maps.Clone (Go 1.21+) as suggested by Gemini Pro review. Co-Authored-By: Virgil --- pkg/core/crash.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/core/crash.go b/pkg/core/crash.go index bf1fb94..6a9ed87 100644 --- a/pkg/core/crash.go +++ b/pkg/core/crash.go @@ -9,6 +9,7 @@ package core import ( "encoding/json" "fmt" + "maps" "os" "runtime" "runtime/debug" @@ -48,7 +49,8 @@ func WithCrashFile(path string) CrashOption { // WithCrashMeta adds metadata included in every crash report. func WithCrashMeta(meta map[string]string) CrashOption { - return func(h *CrashHandler) { h.meta = meta } + cloned := maps.Clone(meta) + return func(h *CrashHandler) { h.meta = cloned } } // WithCrashHandler sets a callback invoked on every crash.