Skip to content

Commit

Permalink
Merge pull request #1564 from AkihiroSuda/fix-1562
Browse files Browse the repository at this point in the history
bake: SOURCE_DATE_EPOCH: fix `panic: assignment to entry in nil map`
  • Loading branch information
jedevc authored Jan 29, 2023
2 parents a718d07 + 1f56f51 commit 8af76c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bake/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8af76c6

Please sign in to comment.