Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
eb1717e0
Commit
eb1717e0
authored
Nov 03, 2011
by
Vincent Vanackere
Committed by
Rob Pike
Nov 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r CC=golang-dev
https://golang.org/cl/5334050
parent
de03d502
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
39 additions
and
39 deletions
+39
-39
doc/codewalk/markov.xml
doc/codewalk/markov.xml
+2
-2
doc/effective_go.html
doc/effective_go.html
+1
-1
doc/effective_go.tmpl
doc/effective_go.tmpl
+1
-1
src/pkg/archive/tar/reader.go
src/pkg/archive/tar/reader.go
+2
-2
src/pkg/bufio/bufio.go
src/pkg/bufio/bufio.go
+4
-4
src/pkg/bytes/buffer.go
src/pkg/bytes/buffer.go
+6
-6
src/pkg/crypto/openpgp/armor/armor.go
src/pkg/crypto/openpgp/armor/armor.go
+1
-1
src/pkg/crypto/tls/conn.go
src/pkg/crypto/tls/conn.go
+1
-1
src/pkg/encoding/xml/xml.go
src/pkg/encoding/xml/xml.go
+1
-1
src/pkg/encoding/xml/xml_test.go
src/pkg/encoding/xml/xml_test.go
+3
-3
src/pkg/fmt/scan.go
src/pkg/fmt/scan.go
+1
-1
src/pkg/html/doc.go
src/pkg/html/doc.go
+1
-1
src/pkg/html/token.go
src/pkg/html/token.go
+2
-2
src/pkg/math/big/int.go
src/pkg/math/big/int.go
+1
-1
src/pkg/mime/multipart/multipart.go
src/pkg/mime/multipart/multipart.go
+1
-1
src/pkg/mime/multipart/multipart_test.go
src/pkg/mime/multipart/multipart_test.go
+2
-2
src/pkg/net/http/chunked.go
src/pkg/net/http/chunked.go
+1
-1
src/pkg/net/http/serve_test.go
src/pkg/net/http/serve_test.go
+1
-1
src/pkg/net/net_test.go
src/pkg/net/net_test.go
+1
-1
src/pkg/net/textproto/reader.go
src/pkg/net/textproto/reader.go
+1
-1
src/pkg/os/dir_unix.go
src/pkg/os/dir_unix.go
+1
-1
src/pkg/os/file_unix.go
src/pkg/os/file_unix.go
+1
-1
src/pkg/os/file_windows.go
src/pkg/os/file_windows.go
+1
-1
src/pkg/scanner/scanner.go
src/pkg/scanner/scanner.go
+1
-1
src/pkg/strings/reader.go
src/pkg/strings/reader.go
+1
-1
No files found.
doc/codewalk/markov.xml
View file @
eb1717e0
...
...
@@ -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>
...
...
doc/effective_go.html
View file @
eb1717e0
...
...
@@ -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.
...
...
doc/effective_go.tmpl
View file @
eb1717e0
...
...
@@ -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
.
...
...
src/pkg/archive/tar/reader.go
View file @
eb1717e0
...
...
@@ -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
{
...
...
src/pkg/bufio/bufio.go
View file @
eb1717e0
...
...
@@ -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
)
{
...
...
src/pkg/bytes/buffer.go
View file @
eb1717e0
...
...
@@ -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
)
{
...
...
src/pkg/crypto/openpgp/armor/armor.go
View file @
eb1717e0
...
...
@@ -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
)
{
...
...
src/pkg/crypto/tls/conn.go
View file @
eb1717e0
...
...
@@ -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
()
{
...
...
src/pkg/encoding/xml/xml.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/encoding/xml/xml_test.go
View file @
eb1717e0
...
...
@@ -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
)
}
}
...
...
src/pkg/fmt/scan.go
View file @
eb1717e0
...
...
@@ -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
)
{
...
...
src/pkg/html/doc.go
View file @
eb1717e0
...
...
@@ -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())
...
...
src/pkg/html/token.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/math/big/int.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/mime/multipart/multipart.go
View file @
eb1717e0
...
...
@@ -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
()
...
...
src/pkg/mime/multipart/multipart_test.go
View file @
eb1717e0
...
...
@@ -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
)
}
}
...
...
src/pkg/net/http/chunked.go
View file @
eb1717e0
...
...
@@ -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.
...
...
src/pkg/net/http/serve_test.go
View file @
eb1717e0
...
...
@@ -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
)
...
...
src/pkg/net/net_test.go
View file @
eb1717e0
...
...
@@ -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
()
...
...
src/pkg/net/textproto/reader.go
View file @
eb1717e0
...
...
@@ -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
()
...
...
src/pkg/os/dir_unix.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/os/file_unix.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/os/file_windows.go
View file @
eb1717e0
...
...
@@ -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
...
...
src/pkg/scanner/scanner.go
View file @
eb1717e0
...
...
@@ -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)
...
...
src/pkg/strings/reader.go
View file @
eb1717e0
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment