Skip to content

Commit

Permalink
Simplify MultiPipe()
Browse files Browse the repository at this point in the history
  • Loading branch information
timdp committed Apr 29, 2018
1 parent bc7baaa commit 3a12529
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/pkg/lwcutil/pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ func GetPipeWriters(pipes []Pipe) []*io.PipeWriter {
}

func MultiPipe(reader io.Reader, pws []*io.PipeWriter) {
numCounts := len(pws)
writers := make([]io.Writer, numCounts)
for i := 0; i < numCounts; i++ {
defer pws[i].Close()
writers[i] = io.Writer(pws[i])
writers := make([]io.Writer, len(pws))
for i, pw := range pws {
defer pw.Close()
writers[i] = io.Writer(pw)
}
writer := io.MultiWriter(writers...)
if _, err := io.Copy(writer, reader); err != nil {
Expand Down

0 comments on commit 3a12529

Please sign in to comment.