@@ -22,7 +22,8 @@ import (
2222 "golang.org/x/sync/errgroup"
2323)
2424
25- var g flightcontrol.Group
25+ var g flightcontrol.Group [struct {}]
26+ var gFileList flightcontrol.Group [[]string ]
2627
2728const containerdUncompressed = "containerd.io/uncompressed"
2829
@@ -86,12 +87,12 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
8687
8788 if _ , ok := filter [sr .ID ()]; ok {
8889 eg .Go (func () error {
89- _ , err := g .Do (ctx , fmt .Sprintf ("%s-%t" , sr .ID (), createIfNeeded ), func (ctx context.Context ) (interface {}, error ) {
90+ _ , err := g .Do (ctx , fmt .Sprintf ("%s-%t" , sr .ID (), createIfNeeded ), func (ctx context.Context ) (struct {}, error ) {
9091 if sr .getBlob () != "" {
91- return nil , nil
92+ return struct {}{} , nil
9293 }
9394 if ! createIfNeeded {
94- return nil , errors .WithStack (ErrNoBlobs )
95+ return struct {}{} , errors .WithStack (ErrNoBlobs )
9596 }
9697
9798 compressorFunc , finalize := comp .Type .Compress (ctx , comp )
@@ -108,12 +109,12 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
108109 if lowerRef != nil {
109110 m , err := lowerRef .Mount (ctx , true , s )
110111 if err != nil {
111- return nil , err
112+ return struct {}{} , err
112113 }
113114 var release func () error
114115 lower , release , err = m .Mount ()
115116 if err != nil {
116- return nil , err
117+ return struct {}{} , err
117118 }
118119 if release != nil {
119120 defer release ()
@@ -131,12 +132,12 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
131132 if upperRef != nil {
132133 m , err := upperRef .Mount (ctx , true , s )
133134 if err != nil {
134- return nil , err
135+ return struct {}{} , err
135136 }
136137 var release func () error
137138 upper , release , err = m .Mount ()
138139 if err != nil {
139- return nil , err
140+ return struct {}{} , err
140141 }
141142 if release != nil {
142143 defer release ()
@@ -151,7 +152,7 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
151152 if forceOvlStr := os .Getenv ("BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF" ); forceOvlStr != "" && sr .kind () != Diff {
152153 enableOverlay , err = strconv .ParseBool (forceOvlStr )
153154 if err != nil {
154- return nil , errors .Wrapf (err , "invalid boolean in BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF" )
155+ return struct {}{} , errors .Wrapf (err , "invalid boolean in BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF" )
155156 }
156157 fallback = false // prohibit fallback on debug
157158 } else if ! isTypeWindows (sr ) {
@@ -173,10 +174,10 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
173174 if ! ok || err != nil {
174175 if ! fallback {
175176 if ! ok {
176- return nil , errors .Errorf ("overlay mounts not detected (lower=%+v,upper=%+v)" , lower , upper )
177+ return struct {}{} , errors .Errorf ("overlay mounts not detected (lower=%+v,upper=%+v)" , lower , upper )
177178 }
178179 if err != nil {
179- return nil , errors .Wrapf (err , "failed to compute overlay diff" )
180+ return struct {}{} , errors .Wrapf (err , "failed to compute overlay diff" )
180181 }
181182 }
182183 if logWarnOnErr {
@@ -209,7 +210,7 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
209210 diff .WithCompressor (compressorFunc ),
210211 )
211212 if err != nil {
212- return nil , err
213+ return struct {}{} , err
213214 }
214215 }
215216
@@ -219,29 +220,29 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
219220 if finalize != nil {
220221 a , err := finalize (ctx , sr .cm .ContentStore )
221222 if err != nil {
222- return nil , errors .Wrapf (err , "failed to finalize compression" )
223+ return struct {}{} , errors .Wrapf (err , "failed to finalize compression" )
223224 }
224225 for k , v := range a {
225226 desc .Annotations [k ] = v
226227 }
227228 }
228229 info , err := sr .cm .ContentStore .Info (ctx , desc .Digest )
229230 if err != nil {
230- return nil , err
231+ return struct {}{} , err
231232 }
232233
233234 if diffID , ok := info .Labels [containerdUncompressed ]; ok {
234235 desc .Annotations [containerdUncompressed ] = diffID
235236 } else if mediaType == ocispecs .MediaTypeImageLayer {
236237 desc .Annotations [containerdUncompressed ] = desc .Digest .String ()
237238 } else {
238- return nil , errors .Errorf ("unknown layer compression type" )
239+ return struct {}{} , errors .Errorf ("unknown layer compression type" )
239240 }
240241
241242 if err := sr .setBlob (ctx , desc ); err != nil {
242- return nil , err
243+ return struct {}{} , err
243244 }
244- return nil , nil
245+ return struct {}{} , nil
245246 })
246247 if err != nil {
247248 return err
@@ -415,29 +416,29 @@ func isTypeWindows(sr *immutableRef) bool {
415416
416417// ensureCompression ensures the specified ref has the blob of the specified compression Type.
417418func ensureCompression (ctx context.Context , ref * immutableRef , comp compression.Config , s session.Group ) error {
418- _ , err := g .Do (ctx , fmt .Sprintf ("%s-%s" , ref .ID (), comp .Type ), func (ctx context.Context ) (interface {}, error ) {
419+ _ , err := g .Do (ctx , fmt .Sprintf ("ensureComp- %s-%s" , ref .ID (), comp .Type ), func (ctx context.Context ) (struct {}, error ) {
419420 desc , err := ref .ociDesc (ctx , ref .descHandlers , true )
420421 if err != nil {
421- return nil , err
422+ return struct {}{} , err
422423 }
423424
424425 // Resolve converters
425426 layerConvertFunc , err := getConverter (ctx , ref .cm .ContentStore , desc , comp )
426427 if err != nil {
427- return nil , err
428+ return struct {}{} , err
428429 } else if layerConvertFunc == nil {
429430 if isLazy , err := ref .isLazy (ctx ); err != nil {
430- return nil , err
431+ return struct {}{} , err
431432 } else if isLazy {
432433 // This ref can be used as the specified compressionType. Keep it lazy.
433- return nil , nil
434+ return struct {}{} , nil
434435 }
435- return nil , ref .linkBlob (ctx , desc )
436+ return struct {}{} , ref .linkBlob (ctx , desc )
436437 }
437438
438439 // First, lookup local content store
439440 if _ , err := ref .getBlobWithCompression (ctx , comp .Type ); err == nil {
440- return nil , nil // found the compression variant. no need to convert.
441+ return struct {}{} , nil // found the compression variant. no need to convert.
441442 }
442443
443444 // Convert layer compression type
@@ -447,18 +448,18 @@ func ensureCompression(ctx context.Context, ref *immutableRef, comp compression.
447448 dh : ref .descHandlers [desc .Digest ],
448449 session : s ,
449450 }).Unlazy (ctx ); err != nil {
450- return nil , err
451+ return struct {}{} , err
451452 }
452453 newDesc , err := layerConvertFunc (ctx , ref .cm .ContentStore , desc )
453454 if err != nil {
454- return nil , errors .Wrapf (err , "failed to convert" )
455+ return struct {}{} , errors .Wrapf (err , "failed to convert" )
455456 }
456457
457458 // Start to track converted layer
458459 if err := ref .linkBlob (ctx , * newDesc ); err != nil {
459- return nil , errors .Wrapf (err , "failed to add compression blob" )
460+ return struct {}{} , errors .Wrapf (err , "failed to add compression blob" )
460461 }
461- return nil , nil
462+ return struct {}{} , nil
462463 })
463464 return err
464465}
0 commit comments