From 8ac25c5c8d533738748ac89d1a31ac08e976fe77 Mon Sep 17 00:00:00 2001 From: Dean Chen <862469039@qq.com> Date: Thu, 23 Jul 2026 07:45:18 +0500 Subject: [PATCH] fix(action): avoid copylocks when copying Configuration for client-only Configuration embeds sync.Mutex and logging.LogHolder (atomic.Pointer), so a value copy (*i.cfg) fails govet copylocks under golangci-lint. Build a local Configuration by copying fields explicitly and reattaching the logger via SetLogger instead. Signed-off-by: Dean Chen <862469039@qq.com> --- pkg/action/install.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index b3cab7160..b00ec6d88 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -332,9 +332,22 @@ func (i *Install) RunWithContext(ctx context.Context, ch ci.Charter, vals map[st // not mutate the shared *Configuration passed to NewInstall. // Callers that reuse the same cfg for a later real install must // still observe the original client and storage. See #11463. + // + // Copy fields explicitly: Configuration embeds sync.Mutex and + // logging.LogHolder (atomic.Pointer), which must not be copied + // by value (govet copylocks). origCfg := i.cfg - cfgCopy := *i.cfg - i.cfg = &cfgCopy + cfgCopy := &Configuration{ + RESTClientGetter: origCfg.RESTClientGetter, + Releases: origCfg.Releases, + KubeClient: origCfg.KubeClient, + RegistryClient: origCfg.RegistryClient, + Capabilities: origCfg.Capabilities, + CustomTemplateFuncs: origCfg.CustomTemplateFuncs, + HookOutputFunc: origCfg.HookOutputFunc, + } + cfgCopy.SetLogger(origCfg.Logger().Handler()) + i.cfg = cfgCopy defer func() { i.cfg = origCfg }() // Add mock objects in here so it doesn't use Kube API server