Skip to content

Commit 1fae6f4

Browse files
committed
build: avoid panic on linking to nil target
Note that nil targets still do not work as buildkit does not currently support build inputs with nil values. But this gives cleaner error from buildkit instead of panic on the client side. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
1 parent 606e9d1 commit 1fae6f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

build/build.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,9 +1074,12 @@ func waitContextDeps(ctx context.Context, index int, results *waitmap.Map, so *c
10741074
for _, v := range contexts {
10751075
if len(rr.Refs) > 0 {
10761076
for platform, r := range rr.Refs {
1077-
st, err := r.ToState()
1078-
if err != nil {
1079-
return err
1077+
st := llb.Scratch()
1078+
if r != nil {
1079+
st, err = r.ToState()
1080+
if err != nil {
1081+
return err
1082+
}
10801083
}
10811084
so.FrontendInputs[k+"::"+platform] = st
10821085
so.FrontendAttrs[v+"::"+platform] = "input:" + k + "::" + platform

0 commit comments

Comments
 (0)