aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/archive/tar
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/archive/tar')
-rw-r--r--libgo/go/archive/tar/common.go2
-rw-r--r--libgo/go/archive/tar/reader.go17
2 files changed, 7 insertions, 12 deletions
diff --git a/libgo/go/archive/tar/common.go b/libgo/go/archive/tar/common.go
index 5b781ff..5288587 100644
--- a/libgo/go/archive/tar/common.go
+++ b/libgo/go/archive/tar/common.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// The tar package implements access to tar archives.
+// Package tar implements access to tar archives.
// It aims to cover most of the variations, including those produced
// by GNU and BSD tars.
//
diff --git a/libgo/go/archive/tar/reader.go b/libgo/go/archive/tar/reader.go
index 1b41196..ad06b6d 100644
--- a/libgo/go/archive/tar/reader.go
+++ b/libgo/go/archive/tar/reader.go
@@ -10,6 +10,7 @@ package tar
import (
"bytes"
"io"
+ "io/ioutil"
"os"
"strconv"
)
@@ -27,13 +28,13 @@ var (
// tr := tar.NewReader(r)
// for {
// hdr, err := tr.Next()
-// if err != nil {
-// // handle error
-// }
-// if hdr == nil {
+// if err == os.EOF {
// // end of tar archive
// break
// }
+// if err != nil {
+// // handle error
+// }
// io.Copy(data, tr)
// }
type Reader struct {
@@ -84,12 +85,6 @@ func (tr *Reader) octal(b []byte) int64 {
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.
func (tr *Reader) skipUnread() {
nr := tr.nb + tr.pad // number of bytes to skip
@@ -99,7 +94,7 @@ func (tr *Reader) skipUnread() {
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 {