Merge pull request #1564 from AkihiroSuda/fix-1562

bake: SOURCE_DATE_EPOCH: fix `panic: assignment to entry in nil map`
pull/1566/head
Justin Chadwell 2 years ago committed by GitHub
commit 8af76c68a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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`. // The logic is purposely duplicated from `build/build`.go for keeping this visible in `bake --print`.
if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" { if v := os.Getenv("SOURCE_DATE_EPOCH"); v != "" {
for _, f := range m { for _, f := range m {
if f.Args == nil {
f.Args = make(map[string]*string)
}
if _, ok := f.Args["SOURCE_DATE_EPOCH"]; !ok { if _, ok := f.Args["SOURCE_DATE_EPOCH"]; !ok {
f.Args["SOURCE_DATE_EPOCH"] = &v f.Args["SOURCE_DATE_EPOCH"] = &v
} }

Loading…
Cancel
Save