]> Cypherpunks repositories - gostls13.git/commitdiff
all: rename os.EOF to io.EOF in various non-code contexts
authorVincent Vanackere <vincent.vanackere@gmail.com>
Thu, 3 Nov 2011 21:01:30 +0000 (14:01 -0700)
committerRob Pike <r@golang.org>
Thu, 3 Nov 2011 21:01:30 +0000 (14:01 -0700)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050

25 files changed:
doc/codewalk/markov.xml
doc/effective_go.html
doc/effective_go.tmpl
src/pkg/archive/tar/reader.go
src/pkg/bufio/bufio.go
src/pkg/bytes/buffer.go
src/pkg/crypto/openpgp/armor/armor.go
src/pkg/crypto/tls/conn.go
src/pkg/encoding/xml/xml.go
src/pkg/encoding/xml/xml_test.go
src/pkg/fmt/scan.go
src/pkg/html/doc.go
src/pkg/html/token.go
src/pkg/math/big/int.go
src/pkg/mime/multipart/multipart.go
src/pkg/mime/multipart/multipart_test.go
src/pkg/net/http/chunked.go
src/pkg/net/http/serve_test.go
src/pkg/net/net_test.go
src/pkg/net/textproto/reader.go
src/pkg/os/dir_unix.go
src/pkg/os/file_unix.go
src/pkg/os/file_windows.go
src/pkg/scanner/scanner.go
src/pkg/strings/reader.go

index a89b4d0ce8c66eebf6de9e8e3473c30f410bc130..81df1289c21605fe06dfe428c793943213d6ffe1 100644 (file)
@@ -105,7 +105,7 @@ Prefix               Map key
        reads space-separated values from an <code>io.Reader</code>.
        <br/><br/>
        The <code>Build</code> method returns once the <code>Reader</code>'s
-       <code>Read</code> method returns <code>os.EOF</code> (end of file)
+       <code>Read</code> method returns <code>io.EOF</code> (end of file)
        or some other read error occurs.
 </step>
 
@@ -133,7 +133,7 @@ Prefix               Map key
        (including punctuation), which is exactly what we need.
        <br/><br/>
        <code>Fscan</code> returns an error if it encounters a read error
-       (<code>os.EOF</code>, for example) or if it can't scan the requested
+       (<code>io.EOF</code>, for example) or if it can't scan the requested
        value (in our case, a single string). In either case we just want to
        stop scanning, so we <code>break</code> out of the loop.
 </step>
index 8267564740c931b69543ac60bf0bcac458f12b97..a58989ab553470085ab2edab283c01ae1d00e819 100644 (file)
@@ -825,7 +825,7 @@ func Contents(filename string) (string, error) {
         n, err := f.Read(buf[0:])
         result = append(result, buf[0:n]...) // append is discussed later.
         if err != nil {
-            if err == os.EOF {
+            if err == io.EOF {
                 break
             }
             return "", err  // f will be closed if we return here.
index aa011f2a014abfd2c11f73006bdb3bc786fc2ecd..842f026e1070eaf74e0b3965e01e82a3f4c60075 100644 (file)
@@ -825,7 +825,7 @@ func Contents(filename string) (string, error) {
         n, err := f.Read(buf[0:])
         result = append(result, buf[0:n]...) // append is discussed later.
         if err != nil {
-            if err == os.EOF {
+            if err == io.EOF {
                 break
             }
             return "", err  // f will be closed if we return here.
index 65bf1204ab426f3fbc6cd2e581122cdcb897c36e..facba2cc7a3e6726ded3c9e5133bc0f1eb69de23 100644 (file)
@@ -29,7 +29,7 @@ var (
 //     tr := tar.NewReader(r)
 //     for {
 //             hdr, err := tr.Next()
-//             if err == os.EOF {
+//             if err == io.EOF {
 //                     // end of tar archive
 //                     break
 //             }
@@ -200,7 +200,7 @@ func (tr *Reader) readHeader() *Header {
 }
 
 // Read reads from the current entry in the tar archive.
-// It returns 0, os.EOF when it reaches the end of that entry,
+// It returns 0, io.EOF when it reaches the end of that entry,
 // until Next is called to advance to the next entry.
 func (tr *Reader) Read(b []byte) (n int, err error) {
        if tr.nb == 0 {
index 0b354fda82fa3f999d42b7c1d3626981c2bb0f9b..7c4f90d85c14bcdb2b92c748285a8631e6db88ce 100644 (file)
@@ -135,7 +135,7 @@ func (b *Reader) Peek(n int) ([]byte, error) {
 // It returns the number of bytes read into p.
 // It calls Read at most once on the underlying Reader,
 // hence n may be less than len(p).
-// At EOF, the count will be zero and err will be os.EOF.
+// At EOF, the count will be zero and err will be io.EOF.
 func (b *Reader) Read(p []byte) (n int, err error) {
        n = len(p)
        if n == 0 {
@@ -246,7 +246,7 @@ func (b *Reader) Buffered() int { return b.w - b.r }
 // returning a slice pointing at the bytes in the buffer.
 // The bytes stop being valid at the next read call.
 // If ReadSlice encounters an error before finding a delimiter,
-// it returns all the data in the buffer and the error itself (often os.EOF).
+// it returns all the data in the buffer and the error itself (often io.EOF).
 // ReadSlice fails with error ErrBufferFull if the buffer fills without a delim.
 // Because the data returned from ReadSlice will be overwritten
 // by the next I/O operation, most clients should use
@@ -332,7 +332,7 @@ func (b *Reader) ReadLine() (line []byte, isPrefix bool, err error) {
 // ReadBytes reads until the first occurrence of delim in the input,
 // returning a slice containing the data up to and including the delimiter.
 // If ReadBytes encounters an error before finding a delimiter,
-// it returns the data read before the error and the error itself (often os.EOF).
+// it returns the data read before the error and the error itself (often io.EOF).
 // ReadBytes returns err != nil if and only if the returned data does not end in
 // delim.
 func (b *Reader) ReadBytes(delim byte) (line []byte, err error) {
@@ -379,7 +379,7 @@ func (b *Reader) ReadBytes(delim byte) (line []byte, err error) {
 // ReadString reads until the first occurrence of delim in the input,
 // returning a string containing the data up to and including the delimiter.
 // If ReadString encounters an error before finding a delimiter,
-// it returns the data read before the error and the error itself (often os.EOF).
+// it returns the data read before the error and the error itself (often io.EOF).
 // ReadString returns err != nil if and only if the returned data does not end in
 // delim.
 func (b *Reader) ReadString(delim byte) (line string, err error) {
index fbfd6210b641eda6ba0a51938fd42428dda61438..d1a5b68dc812527dd33b223105d98e4069ab7a03 100644 (file)
@@ -117,7 +117,7 @@ const MinRead = 512
 
 // ReadFrom reads data from r until EOF and appends it to the buffer.
 // The return value n is the number of bytes read.
-// Any error except os.EOF encountered during the read
+// Any error except io.EOF encountered during the read
 // is also returned.
 func (b *Buffer) ReadFrom(r io.Reader) (n int64, err error) {
        b.lastRead = opInvalid
@@ -200,7 +200,7 @@ func (b *Buffer) WriteRune(r rune) (n int, err error) {
 
 // Read reads the next len(p) bytes from the buffer or until the buffer
 // is drained.  The return value n is the number of bytes read.  If the
-// buffer has no data to return, err is os.EOF even if len(p) is zero;
+// buffer has no data to return, err is io.EOF even if len(p) is zero;
 // otherwise it is nil.
 func (b *Buffer) Read(p []byte) (n int, err error) {
        b.lastRead = opInvalid
@@ -236,7 +236,7 @@ func (b *Buffer) Next(n int) []byte {
 }
 
 // ReadByte reads and returns the next byte from the buffer.
-// If no byte is available, it returns error os.EOF.
+// If no byte is available, it returns error io.EOF.
 func (b *Buffer) ReadByte() (c byte, err error) {
        b.lastRead = opInvalid
        if b.off >= len(b.buf) {
@@ -252,7 +252,7 @@ func (b *Buffer) ReadByte() (c byte, err error) {
 
 // ReadRune reads and returns the next UTF-8-encoded
 // Unicode code point from the buffer.
-// If no bytes are available, the error returned is os.EOF.
+// If no bytes are available, the error returned is io.EOF.
 // If the bytes are an erroneous UTF-8 encoding, it
 // consumes one byte and returns U+FFFD, 1.
 func (b *Buffer) ReadRune() (r rune, size int, err error) {
@@ -307,7 +307,7 @@ func (b *Buffer) UnreadByte() error {
 // ReadBytes reads until the first occurrence of delim in the input,
 // returning a slice containing the data up to and including the delimiter.
 // If ReadBytes encounters an error before finding a delimiter,
-// it returns the data read before the error and the error itself (often os.EOF).
+// it returns the data read before the error and the error itself (often io.EOF).
 // ReadBytes returns err != nil if and only if the returned data does not end in
 // delim.
 func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
@@ -326,7 +326,7 @@ func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
 // ReadString reads until the first occurrence of delim in the input,
 // returning a string containing the data up to and including the delimiter.
 // If ReadString encounters an error before finding a delimiter,
-// it returns the data read before the error and the error itself (often os.EOF).
+// it returns the data read before the error and the error itself (often io.EOF).
 // ReadString returns err != nil if and only if the returned data does not end
 // in delim.
 func (b *Buffer) ReadString(delim byte) (line string, err error) {
index 707bdf354b3f5c814067f70639bc6909b5416cd7..3bbb5dc351a148ff9d81bedf073c94cd1d6de512 100644 (file)
@@ -151,7 +151,7 @@ func (r *openpgpReader) Read(p []byte) (n int, err error) {
 }
 
 // Decode reads a PGP armored block from the given Reader. It will ignore
-// leading garbage. If it doesn't find a block, it will return nil, os.EOF. The
+// leading garbage. If it doesn't find a block, it will return nil, io.EOF. The
 // given Reader is not usable after calling this function: an arbitrary amount
 // of data may have been read past the end of the block.
 func Decode(in io.Reader) (p *Block, err error) {
index 6312c34d6d75523b67ce28cd4697e4ba9240c7a6..f4178e30c58248dcdd1e777eb5dd03b35e6cbe58 100644 (file)
@@ -471,7 +471,7 @@ Again:
                // RFC suggests that EOF without an alertCloseNotify is
                // an error, but popular web sites seem to do this,
                // so we can't make it an error.
-               // if err == os.EOF {
+               // if err == io.EOF {
                //      err = io.ErrUnexpectedEOF
                // }
                if e, ok := err.(net.Error); !ok || !e.Temporary() {
index d534c52c1caea960d8ad2b2bb090e0ab8c7d22b6..525635067e1f6db8075e7cbf53a0f305fb33d982 100644 (file)
@@ -197,7 +197,7 @@ func NewParser(r io.Reader) *Parser {
 }
 
 // Token returns the next XML token in the input stream.
-// At the end of the input stream, Token returns nil, os.EOF.
+// At the end of the input stream, Token returns nil, io.EOF.
 //
 // Slices of bytes in the returned token data refer to the
 // parser's internal buffer and remain valid only until the next
index 1b40d0c4d412c7c5fe38448c783f7373641131f4..6c874fadb7a0d7d03d688161d4ae2e64c30b4020 100644 (file)
@@ -520,7 +520,7 @@ func TestTrailingRawToken(t *testing.T) {
        for _, err = p.RawToken(); err == nil; _, err = p.RawToken() {
        }
        if err != io.EOF {
-               t.Fatalf("p.RawToken() = _, %v, want _, os.EOF", err)
+               t.Fatalf("p.RawToken() = _, %v, want _, io.EOF", err)
        }
 }
 
@@ -531,7 +531,7 @@ func TestTrailingToken(t *testing.T) {
        for _, err = p.Token(); err == nil; _, err = p.Token() {
        }
        if err != io.EOF {
-               t.Fatalf("p.Token() = _, %v, want _, os.EOF", err)
+               t.Fatalf("p.Token() = _, %v, want _, io.EOF", err)
        }
 }
 
@@ -542,7 +542,7 @@ func TestEntityInsideCDATA(t *testing.T) {
        for _, err = p.Token(); err == nil; _, err = p.Token() {
        }
        if err != io.EOF {
-               t.Fatalf("p.Token() = _, %v, want _, os.EOF", err)
+               t.Fatalf("p.Token() = _, %v, want _, io.EOF", err)
        }
 }
 
index 54a9fe2951e04eb68dfaf14416dd9e117cfbdfb7..7ac3b8edcc171f7ed41749276c6b96c09e1455f3 100644 (file)
@@ -219,7 +219,7 @@ func (s *ss) getRune() (r rune) {
        return
 }
 
-// mustReadRune turns os.EOF into a panic(io.ErrUnexpectedEOF).
+// mustReadRune turns io.EOF into a panic(io.ErrUnexpectedEOF).
 // It is called in cases such as string scanning where an EOF is a
 // syntax error.
 func (s *ss) mustReadRune() (r rune) {
index ba9d188486f3ecce1f1508f4cfa355a21a7a2107..0620679bd645f8d59093b7a6a10692080ba36343 100644 (file)
@@ -36,7 +36,7 @@ lower-cased, and attributes are collected into a []Attribute. For example:
 
        for {
                if z.Next() == html.ErrorToken {
-                       // Returning os.EOF indicates success.
+                       // Returning io.EOF indicates success.
                        return z.Error()
                }
                emitToken(z.Token())
index c5b8a1c710e7af94a99f837f44b88fdcfb05ce06..9213844728b82059623d13a30b61dcca95733de1 100644 (file)
@@ -123,7 +123,7 @@ type Tokenizer struct {
        // for tt != Error && err != nil to hold: this means that Next returned a
        // valid token but the subsequent Next call will return an error token.
        // For example, if the HTML text input was just "plain", then the first
-       // Next call would set z.err to os.EOF but return a TextToken, and all
+       // Next call would set z.err to io.EOF but return a TextToken, and all
        // subsequent Next calls would return an ErrorToken.
        // err is never reset. Once it becomes non-nil, it stays non-nil.
        err error
@@ -150,7 +150,7 @@ type Tokenizer struct {
 }
 
 // Error returns the error associated with the most recent ErrorToken token.
-// This is typically os.EOF, meaning the end of tokenization.
+// This is typically io.EOF, meaning the end of tokenization.
 func (z *Tokenizer) Error() error {
        if z.tt != ErrorToken {
                return nil
index c6affbbdaebe1929e60d0febcab3921d17870775..f325723804f7f337ac3e09449cc0b2309f1d76cb 100644 (file)
@@ -516,7 +516,7 @@ func (z *Int) SetString(s string, base int) (*Int, bool) {
        if err != io.EOF {
                return nil, false
        }
-       return z, true // err == os.EOF => scan consumed all of s
+       return z, true // err == io.EOF => scan consumed all of s
 }
 
 // SetBytes interprets buf as the bytes of a big-endian unsigned
index 24b0e41cae1e5bbd49358314d670a7b614fd4184..64a11e6d9d908848eaf1c10c7f33d8b6ebb0deaf 100644 (file)
@@ -176,7 +176,7 @@ type Reader struct {
 }
 
 // NextPart returns the next part in the multipart or an error.
-// When there are no more parts, the error os.EOF is returned.
+// When there are no more parts, the error io.EOF is returned.
 func (mr *Reader) NextPart() (*Part, error) {
        if mr.currentPart != nil {
                mr.currentPart.Close()
index dd5d7c12f7f49569e3f726c458a8f7b3e1e79dd9..ce2a27c4413dd0c3edaa1760c0d7140ea095e0de 100644 (file)
@@ -214,7 +214,7 @@ func testMultipart(t *testing.T, r io.Reader, onlyNewlines bool) {
                t.Error("Didn't expect a fifth part.")
        }
        if err != io.EOF {
-               t.Errorf("On fifth part expected os.EOF; got %v", err)
+               t.Errorf("On fifth part expected io.EOF; got %v", err)
        }
 }
 
@@ -259,7 +259,7 @@ func TestVariousTextLineEndings(t *testing.T) {
                        t.Errorf("Unexpected part in test %d", testNum)
                }
                if err != io.EOF {
-                       t.Errorf("On test %d expected os.EOF; got %v", testNum, err)
+                       t.Errorf("On test %d expected io.EOF; got %v", testNum, err)
                }
 
        }
index 157e1c46c3b206fd3bd82de691279e92485b5702..76beb15c3485d7e568d08074499b1d27ad17913b 100644 (file)
@@ -67,7 +67,7 @@ func (cw *chunkedWriter) Close() error {
 
 // NewChunkedReader returns a new reader that translates the data read from r
 // out of HTTP "chunked" format before returning it. 
-// The reader returns os.EOF when the final 0-length chunk is read.
+// The reader returns io.EOF when the final 0-length chunk is read.
 //
 // NewChunkedReader is not needed by normal applications. The http package
 // automatically decodes chunking when reading response bodies.
index 98e10d433e889ee313f03ffc9c36072c3752bea4..21273711bbab9114e5718c60941e251f254e83a8 100644 (file)
@@ -824,7 +824,7 @@ func TestRedirectMunging(t *testing.T) {
 // explicit Content-Length of zero is present), then the transport can re-use the
 // connection immediately. But when it re-uses the connection, it typically closes
 // the previous request's body, which is not optimal for zero-lengthed bodies,
-// as the client would then see http.ErrBodyReadAfterClose and not 0, os.EOF.
+// as the client would then see http.ErrBodyReadAfterClose and not 0, io.EOF.
 func TestZeroLengthPostAndResponse(t *testing.T) {
        ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, r *Request) {
                all, err := ioutil.ReadAll(r.Body)
index d2839d719fddf12ce05fbefe317afb20b11cceb9..0dc86698e1023125b7216437490723ebc3101760 100644 (file)
@@ -147,7 +147,7 @@ func TestShutdown(t *testing.T) {
                var buf [10]byte
                n, err := c.Read(buf[:])
                if n != 0 || err != io.EOF {
-                       t.Fatalf("server Read = %d, %v; want 0, os.EOF", n, err)
+                       t.Fatalf("server Read = %d, %v; want 0, io.EOF", n, err)
                }
                c.Write([]byte("response"))
                c.Close()
index 658b5c282ec926111d9374de744fb211efd6d464..793c6c2c83e5fb9b8ef1ec3bb7a6b72b533711bf 100644 (file)
@@ -299,7 +299,7 @@ func (r *Reader) ReadResponse(expectCode int) (code int, message string, err err
 //
 // The decoded form returned by the Reader's Read method
 // rewrites the "\r\n" line endings into the simpler "\n",
-// removes leading dot escapes if present, and stops with error os.EOF
+// removes leading dot escapes if present, and stops with error io.EOF
 // after consuming (and discarding) the end-of-sequence line.
 func (r *Reader) DotReader() io.Reader {
        r.closeDot()
index e59c1af2ea758c4cdd353455202b07a35c83a6c0..a16bcf63f41b4abe8291f2f5992baaab5c2bbd3e 100644 (file)
@@ -19,7 +19,7 @@ const (
 //
 // If n > 0, Readdirnames returns at most n names. In this case, if
 // Readdirnames returns an empty slice, it will return a non-nil error
-// explaining why. At the end of a directory, the error is os.EOF.
+// explaining why. At the end of a directory, the error is io.EOF.
 //
 // If n <= 0, Readdirnames returns all the names from the directory in
 // a single slice. In this case, if Readdirnames succeeds (reads all
index f4038168fcc199be0bdb0840cf98f0604d91aa7f..02ba31623041b33b9ccf04bf5f61e1cb9f87b891 100644 (file)
@@ -136,7 +136,7 @@ func Lstat(name string) (fi *FileInfo, err error) {
 //
 // If n > 0, Readdir returns at most n FileInfo structures. In this case, if
 // Readdir returns an empty slice, it will return a non-nil error
-// explaining why. At the end of a directory, the error is os.EOF.
+// explaining why. At the end of a directory, the error is io.EOF.
 //
 // If n <= 0, Readdir returns all the FileInfo from the directory in
 // a single slice. In this case, if Readdir succeeds (reads all
index a8c36cb1bc55c31bf4cc63254fc05cfc04c89966..d6a065de54405d573b9ceb0ad48a3cabf06ce415 100644 (file)
@@ -126,7 +126,7 @@ func (file *File) Close() error {
 //
 // If n > 0, Readdir returns at most n FileInfo structures. In this case, if
 // Readdir returns an empty slice, it will return a non-nil error
-// explaining why. At the end of a directory, the error is os.EOF.
+// explaining why. At the end of a directory, the error is io.EOF.
 //
 // If n <= 0, Readdir returns all the FileInfo from the directory in
 // a single slice. In this case, if Readdir succeeds (reads all
index 5ab37792d4c9ed52eb5728bb790f1ca96873cc38..9e230174ca0cfed00d594caa9a8feb31c7ac8b9f 100644 (file)
@@ -235,7 +235,7 @@ func (s *Scanner) next() rune {
                        copy(s.srcBuf[0:], s.srcBuf[s.srcPos:s.srcEnd])
                        s.srcBufOffset += s.srcPos
                        // read more bytes
-                       // (an io.Reader must return os.EOF when it reaches
+                       // (an io.Reader must return io.EOF when it reaches
                        // the end of what it is reading - simply returning
                        // n == 0 will make this loop retry forever; but the
                        // error is in the reader implementation in that case)
index ac8d9dcdf8ed73d624b5077e61ecdc6891633c6d..4f24b5b63806d8a14934fa9d0a913217c25a66df 100644 (file)
@@ -58,7 +58,7 @@ func (r *Reader) UnreadByte() error {
 
 // ReadRune reads and returns the next UTF-8-encoded
 // Unicode code point from the buffer.
-// If no bytes are available, the error returned is os.EOF.
+// If no bytes are available, the error returned is io.EOF.
 // If the bytes are an erroneous UTF-8 encoding, it
 // consumes one byte and returns U+FFFD, 1.
 func (r *Reader) ReadRune() (ch rune, size int, err error) {