From 5a4f80f3ced707762ad3ca62cc11e6a36d0e84e6 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Sun, 29 Jan 2023 08:42:47 +0900 Subject: [PATCH] bake: SOURCE_DATE_EPOCH: fix `panic: assignment to entry in nil map` Fix issue 1562 Signed-off-by: Akihiro Suda (cherry picked from commit 1f56f5174027a91c7c58e1751870abd141b68908) --- bake/bake.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bake/bake.go b/bake/bake.go index 3494b1e1..ab680ad9 100644 --- a/bake/bake.go +++ b/bake/bake.go @@ -144,6 +144,9 @@ func ReadTargets(ctx context.Context, files []File, targets, overrides []string, // The logic is purposely duplicated from `build/build`.go for keeping this visible in `bake --print`. if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" { for _, f := range m { + if f.Args == nil { + f.Args = make(map[string]*string) + } if _, ok := f.Args["SOURCE_DATE_EPOCH"]; !ok { f.Args["SOURCE_DATE_EPOCH"] = &v }