From b00dd420373a50626cd25b0c39ae41e4f5681a6e Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 5 May 2025 11:07:54 -0700 Subject: [PATCH] bake: fix nil deference on empty call definition Signed-off-by: Tonis Tiigi --- commands/bake.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/commands/bake.go b/commands/bake.go index b2cfe60cfa68..49a23c6731f1 100644 --- a/commands/bake.go +++ b/commands/bake.go @@ -261,13 +261,18 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba return err } - for _, opt := range bo { + for k, opt := range bo { if opt.CallFunc != nil { cf, err := buildflags.ParseCallFunc(opt.CallFunc.Name) if err != nil { return err } - opt.CallFunc.Name = cf.Name + if cf == nil { + opt.CallFunc = nil + bo[k] = opt + } else { + opt.CallFunc.Name = cf.Name + } } }