From c7d1a6030e5f632656fc81f794bfba6870675c9c Mon Sep 17 00:00:00 2001 From: Guillaume Lours Date: Mon, 30 Mar 2026 17:19:55 +0200 Subject: [PATCH] fix: use pointer receivers for composeService methods with sync.Once fields Moving runtimeVersionCache from a package-level var to instance fields on composeService caused copylocks violations in methods using value receivers, since sync.Once contains sync.noCopy. Switch the 4 affected methods to pointer receivers. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Guillaume Lours --- pkg/compose/build_bake.go | 4 ++-- pkg/compose/hook.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/compose/build_bake.go b/pkg/compose/build_bake.go index 8e7151830..dc691cca9 100644 --- a/pkg/compose/build_bake.go +++ b/pkg/compose/build_bake.go @@ -568,7 +568,7 @@ func dockerFilePath(ctxName string, dockerfile string) string { return dockerfile } -func (s composeService) dryRunBake(cfg bakeConfig) map[string]string { +func (s *composeService) dryRunBake(cfg bakeConfig) map[string]string { bakeResponse := map[string]string{} for name, target := range cfg.Targets { dryRunUUID := fmt.Sprintf("dryRun-%x", sha1.Sum([]byte(name))) @@ -581,7 +581,7 @@ func (s composeService) dryRunBake(cfg bakeConfig) map[string]string { return bakeResponse } -func (s composeService) displayDryRunBuildEvent(name, dryRunUUID, tag string) { +func (s *composeService) displayDryRunBuildEvent(name, dryRunUUID, tag string) { s.events.On(api.Resource{ ID: name + " ==>", Status: api.Done, diff --git a/pkg/compose/hook.go b/pkg/compose/hook.go index 54e55652c..8acc24011 100644 --- a/pkg/compose/hook.go +++ b/pkg/compose/hook.go @@ -31,7 +31,7 @@ import ( "github.com/docker/compose/v5/pkg/utils" ) -func (s composeService) runHook(ctx context.Context, ctr container.Summary, service types.ServiceConfig, hook types.ServiceHook, listener api.ContainerEventListener) error { +func (s *composeService) runHook(ctx context.Context, ctr container.Summary, service types.ServiceConfig, hook types.ServiceHook, listener api.ContainerEventListener) error { wOut := utils.GetWriter(func(line string) { listener(api.ContainerEvent{ Type: api.HookEventLog, @@ -96,7 +96,7 @@ func (s composeService) runHook(ctx context.Context, ctr container.Summary, serv return nil } -func (s composeService) runWaitExec(ctx context.Context, execID string, service types.ServiceConfig, listener api.ContainerEventListener) error { +func (s *composeService) runWaitExec(ctx context.Context, execID string, service types.ServiceConfig, listener api.ContainerEventListener) error { _, err := s.apiClient().ExecStart(ctx, execID, client.ExecStartOptions{ Detach: listener == nil, TTY: service.Tty,