浏览代码

Removed unused utility future.Pv()

Solomon Hykes 12 年之前
父节点
当前提交
deb603aaf4
共有 1 个文件被更改,包括 1 次插入27 次删除
  1. 1 27
      future/future.go

+ 1 - 27
future/future.go

@@ -1,9 +1,6 @@
 package future
 
-import (
-	"fmt"
-	"io"
-)
+import ()
 
 func Go(f func() error) chan error {
 	ch := make(chan error)
@@ -12,26 +9,3 @@ func Go(f func() error) chan error {
 	}()
 	return ch
 }
-
-// Pv wraps an io.Reader such that it is passed through unchanged,
-// but logs the number of bytes copied (comparable to the unix command pv)
-func Pv(src io.Reader, info io.Writer) io.Reader {
-	var totalBytes int
-	data := make([]byte, 2048)
-	r, w := io.Pipe()
-	go func() {
-		for {
-			if n, err := src.Read(data); err != nil {
-				w.CloseWithError(err)
-				return
-			} else {
-				totalBytes += n
-				fmt.Fprintf(info, "--> %d bytes\n", totalBytes)
-				if _, err = w.Write(data[:n]); err != nil {
-					return
-				}
-			}
-		}
-	}()
-	return r
-}