os: be consistent with receiver names for godoc TOC alignment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5449056
diff --git a/src/pkg/os/file.go b/src/pkg/os/file.go
index 6a8d346..71845d3c 100644
--- a/src/pkg/os/file.go
+++ b/src/pkg/os/file.go
@@ -14,7 +14,7 @@
)
// Name returns the name of the file as presented to Open.
-func (file *File) Name() string { return file.name }
+func (f *File) Name() string { return f.name }
// Stdin, Stdout, and Stderr are open Files pointing to the standard input,
// standard output, and standard error file descriptors.
@@ -51,11 +51,11 @@
// Read reads up to len(b) bytes from the File.
// It returns the number of bytes read and an error, if any.
// EOF is signaled by a zero count with err set to io.EOF.
-func (file *File) Read(b []byte) (n int, err error) {
- if file == nil {
+func (f *File) Read(b []byte) (n int, err error) {
+ if f == nil {
return 0, EINVAL
}
- n, e := file.read(b)
+ n, e := f.read(b)
if n < 0 {
n = 0
}
@@ -63,7 +63,7 @@
return 0, io.EOF
}
if e != nil {
- err = &PathError{"read", file.name, e}
+ err = &PathError{"read", f.name, e}
}
return n, err
}
@@ -72,17 +72,17 @@
// It returns the number of bytes read and the error, if any.
// ReadAt always returns a non-nil error when n < len(b).
// At end of file, that error is io.EOF.
-func (file *File) ReadAt(b []byte, off int64) (n int, err error) {
- if file == nil {
+func (f *File) ReadAt(b []byte, off int64) (n int, err error) {
+ if f == nil {
return 0, EINVAL
}
for len(b) > 0 {
- m, e := file.pread(b, off)
+ m, e := f.pread(b, off)
if m == 0 && e == nil {
return n, io.EOF
}
if e != nil {
- err = &PathError{"read", file.name, e}
+ err = &PathError{"read", f.name, e}
break
}
n += m
@@ -95,19 +95,19 @@
// Write writes len(b) bytes to the File.
// It returns the number of bytes written and an error, if any.
// Write returns a non-nil error when n != len(b).
-func (file *File) Write(b []byte) (n int, err error) {
- if file == nil {
+func (f *File) Write(b []byte) (n int, err error) {
+ if f == nil {
return 0, EINVAL
}
- n, e := file.write(b)
+ n, e := f.write(b)
if n < 0 {
n = 0
}
- epipecheck(file, e)
+ epipecheck(f, e)
if e != nil {
- err = &PathError{"write", file.name, e}
+ err = &PathError{"write", f.name, e}
}
return n, err
}
@@ -115,14 +115,14 @@
// WriteAt writes len(b) bytes to the File starting at byte offset off.
// It returns the number of bytes written and an error, if any.
// WriteAt returns a non-nil error when n != len(b).
-func (file *File) WriteAt(b []byte, off int64) (n int, err error) {
- if file == nil {
+func (f *File) WriteAt(b []byte, off int64) (n int, err error) {
+ if f == nil {
return 0, EINVAL
}
for len(b) > 0 {
- m, e := file.pwrite(b, off)
+ m, e := f.pwrite(b, off)
if e != nil {
- err = &PathError{"write", file.name, e}
+ err = &PathError{"write", f.name, e}
break
}
n += m
@@ -136,24 +136,24 @@
// according to whence: 0 means relative to the origin of the file, 1 means
// relative to the current offset, and 2 means relative to the end.
// It returns the new offset and an error, if any.
-func (file *File) Seek(offset int64, whence int) (ret int64, err error) {
- r, e := file.seek(offset, whence)
- if e == nil && file.dirinfo != nil && r != 0 {
+func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
+ r, e := f.seek(offset, whence)
+ if e == nil && f.dirinfo != nil && r != 0 {
e = syscall.EISDIR
}
if e != nil {
- return 0, &PathError{"seek", file.name, e}
+ return 0, &PathError{"seek", f.name, e}
}
return r, nil
}
// WriteString is like Write, but writes the contents of string s rather than
// an array of bytes.
-func (file *File) WriteString(s string) (ret int, err error) {
- if file == nil {
+func (f *File) WriteString(s string) (ret int, err error) {
+ if f == nil {
return 0, EINVAL
}
- return file.Write([]byte(s))
+ return f.Write([]byte(s))
}
// Mkdir creates a new directory with the specified name and permission bits.