From ae13eaae946d19f48fd4c58ded5ae0a539165c38 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 21 Jun 2015 14:14:05 -0400 Subject: [PATCH] tar/asm: remove uneeded goroutine Reported-by: Derek McGowan --- tar/asm/disassemble.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tar/asm/disassemble.go b/tar/asm/disassemble.go index 1021185..30d088b 100644 --- a/tar/asm/disassemble.go +++ b/tar/asm/disassemble.go @@ -74,23 +74,11 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io var csum []byte if hdr.Size > 0 { - sumChan := make(chan []byte) - // if there is a file payload to write, then write the file to the FilePutter - fileRdr, fileWrtr := io.Pipe() - go func() { - defer close(sumChan) - _, csum, err := fp.Put(hdr.Name, fileRdr) - if err != nil { - pW.CloseWithError(err) - } - sumChan <- csum - }() - if _, err = io.Copy(fileWrtr, tr); err != nil { + var err error + _, csum, err = fp.Put(hdr.Name, tr) + if err != nil { pW.CloseWithError(err) - return } - fileWrtr.Close() - csum = <-sumChan } // File entries added, regardless of size