mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Rename os.FD to os.File.
Make Fstat, Readdirnames, and Readdir methods on os.File. R=r DELTA=281 (79 added, 3 deleted, 199 changed) OCL=25891 CL=26130
This commit is contained in:
parent
6479d89378
commit
7a706fb3d7
19 changed files with 270 additions and 194 deletions
|
|
@ -13,12 +13,12 @@ import (
|
|||
)
|
||||
|
||||
type file struct {
|
||||
fd *os.FD;
|
||||
file *os.File;
|
||||
data []byte;
|
||||
}
|
||||
|
||||
func (f *file) close() {
|
||||
f.fd.Close()
|
||||
f.file.Close()
|
||||
}
|
||||
|
||||
func (f *file) getLineFromData() (s string, ok bool) {
|
||||
|
|
@ -46,7 +46,7 @@ func (f *file) readLine() (s string, ok bool) {
|
|||
}
|
||||
if len(f.data) < cap(f.data) {
|
||||
ln := len(f.data);
|
||||
n, err := io.Readn(f.fd, f.data[ln:cap(f.data)]);
|
||||
n, err := io.Readn(f.file, f.data[ln:cap(f.data)]);
|
||||
if n >= 0 {
|
||||
f.data = f.data[0:ln+n];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue