21 lines
274 B
Go
21 lines
274 B
Go
|
package floppy
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
|
||
|
"golang.org/x/sync/errgroup"
|
||
|
)
|
||
|
|
||
|
func Floppy(a, b io.ReadWriter) error {
|
||
|
var g errgroup.Group
|
||
|
g.Go(func() error {
|
||
|
_, err := io.Copy(a, b)
|
||
|
return err
|
||
|
})
|
||
|
g.Go(func() error {
|
||
|
_, err := io.Copy(b, a)
|
||
|
return err
|
||
|
})
|
||
|
return g.Wait()
|
||
|
}
|