]> Cypherpunks repositories - gostls13.git/commitdiff
archive/tar: fix example's handling of os.EOF.
authorDavid Symonds <dsymonds@golang.org>
Wed, 13 Apr 2011 00:56:33 +0000 (10:56 +1000)
committerDavid Symonds <dsymonds@golang.org>
Wed, 13 Apr 2011 00:56:33 +0000 (10:56 +1000)
Fixes #1677.

R=r
CC=golang-dev
https://golang.org/cl/4402042

src/pkg/archive/tar/reader.go

index 1b41196a999a03344957477e906bbffaae958aae..0cfdf355ddb884766521f8274c7d483e8c8c2c4a 100644 (file)
@@ -27,13 +27,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 {