os: turn FileStat.Sys into a method on FileInfo

This reduces the overhead necessary to work with OS-specific
file details, hides the implementation of FileStat, and
preserves the implementation-specific nature of Sys.

Expressions such as:

  stat.(*os.FileInfo).Sys.(*syscall.Stat_t).Uid
  fi1.(*os.FileStat).SameFile(fi2.(*os.FileStat))

Are now spelled as::

  stat.Sys().(*syscall.Stat_t).Uid
  os.SameFile(fi1, fi2)

R=cw, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5448079
This commit is contained in:
Gustavo Niemeyer 2012-02-03 00:16:18 -02:00
parent b9474de2be
commit 20f4385af0
18 changed files with 90 additions and 75 deletions

View file

@ -152,7 +152,7 @@ func (f *File) readdir(n int) (fi []FileInfo, err error) {
if err == nil {
fi[i] = fip
} else {
fi[i] = &FileStat{name: filename}
fi[i] = &fileStat{name: filename}
}
}
return fi, err