bake: fix nil deference on empty call definition

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2025-05-05 11:07:54 -07:00
parent 9a48aca461
commit b00dd42037
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
1 changed files with 7 additions and 2 deletions

View File

@ -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
}
}
}