Skip to content

Commit 7173f0e

Browse files
committed
estargz: Build: remove redundant mutex
each goroutine writes to a distinct index, so it looks like there's no need to use a mutex here. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2531a39 commit 7173f0e

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

estargz/build.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ func Build(tarBlob *io.SectionReader, opt ...Option) (_ *Blob, rErr error) {
235235
}
236236
writers := make([]*Writer, len(tarParts))
237237
payloads := make([]*os.File, len(tarParts))
238-
var mu sync.Mutex
239238
var eg errgroup.Group
240239
for i, parts := range tarParts {
241240
i, parts := i, parts
@@ -257,10 +256,8 @@ func Build(tarBlob *io.SectionReader, opt ...Option) (_ *Blob, rErr error) {
257256
if err := sw.AppendTar(readerFromEntries(parts...)); err != nil {
258257
return err
259258
}
260-
mu.Lock()
261259
writers[i] = sw
262260
payloads[i] = esgzFile
263-
mu.Unlock()
264261
return nil
265262
})
266263
}

0 commit comments

Comments
 (0)