Commit bb1ec0df authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

tar: use ioutil.Discard

This one didn't come up in previous greps.

R=adg
CC=golang-dev
https://golang.org/cl/4430071
parent 9d12307a
...@@ -10,6 +10,7 @@ package tar ...@@ -10,6 +10,7 @@ package tar
import ( import (
"bytes" "bytes"
"io" "io"
"io/ioutil"
"os" "os"
"strconv" "strconv"
) )
...@@ -84,12 +85,6 @@ func (tr *Reader) octal(b []byte) int64 { ...@@ -84,12 +85,6 @@ func (tr *Reader) octal(b []byte) int64 {
return int64(x) return int64(x)
} }
type ignoreWriter struct{}
func (ignoreWriter) Write(b []byte) (n int, err os.Error) {
return len(b), nil
}
// Skip any unread bytes in the existing file entry, as well as any alignment padding. // Skip any unread bytes in the existing file entry, as well as any alignment padding.
func (tr *Reader) skipUnread() { func (tr *Reader) skipUnread() {
nr := tr.nb + tr.pad // number of bytes to skip nr := tr.nb + tr.pad // number of bytes to skip
...@@ -99,7 +94,7 @@ func (tr *Reader) skipUnread() { ...@@ -99,7 +94,7 @@ func (tr *Reader) skipUnread() {
return return
} }
} }
_, tr.err = io.Copyn(ignoreWriter{}, tr.r, nr) _, tr.err = io.Copyn(ioutil.Discard, tr.r, nr)
} }
func (tr *Reader) verifyChecksum(header []byte) bool { func (tr *Reader) verifyChecksum(header []byte) bool {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment