mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
os: remove stuttering return value names
Old style. Make it compliant with our code review comments document. Also, make WriteString's return parameter named 'n', not 'ret', for consistency. Noticed during another documentation review. Change-Id: Ie88910c5841f8353bc5c0152e2168b497578e15e Reviewed-on: https://go-review.googlesource.com/12324 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
4a0d9587f2
commit
90c668d1af
7 changed files with 27 additions and 26 deletions
|
|
@ -82,7 +82,7 @@ const DevNull = "/dev/null"
|
|||
// (O_RDONLY etc.) and perm, (0666 etc.) if applicable. If successful,
|
||||
// methods on the returned File can be used for I/O.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func OpenFile(name string, flag int, perm FileMode) (file *File, err error) {
|
||||
func OpenFile(name string, flag int, perm FileMode) (*File, error) {
|
||||
chmod := false
|
||||
if !supportsCreateWithStickyBit && flag&O_CREATE != 0 && perm&ModeSticky != 0 {
|
||||
if _, err := Stat(name); IsNotExist(err) {
|
||||
|
|
@ -135,12 +135,12 @@ func (file *file) close() error {
|
|||
|
||||
// Stat returns the FileInfo structure describing file.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func (f *File) Stat() (fi FileInfo, err error) {
|
||||
func (f *File) Stat() (FileInfo, error) {
|
||||
if f == nil {
|
||||
return nil, ErrInvalid
|
||||
}
|
||||
var stat syscall.Stat_t
|
||||
err = syscall.Fstat(f.fd, &stat)
|
||||
err := syscall.Fstat(f.fd, &stat)
|
||||
if err != nil {
|
||||
return nil, &PathError{"stat", f.name, err}
|
||||
}
|
||||
|
|
@ -149,9 +149,9 @@ func (f *File) Stat() (fi FileInfo, err error) {
|
|||
|
||||
// Stat returns a FileInfo describing the named file.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func Stat(name string) (fi FileInfo, err error) {
|
||||
func Stat(name string) (FileInfo, error) {
|
||||
var stat syscall.Stat_t
|
||||
err = syscall.Stat(name, &stat)
|
||||
err := syscall.Stat(name, &stat)
|
||||
if err != nil {
|
||||
return nil, &PathError{"stat", name, err}
|
||||
}
|
||||
|
|
@ -162,9 +162,9 @@ func Stat(name string) (fi FileInfo, err error) {
|
|||
// If the file is a symbolic link, the returned FileInfo
|
||||
// describes the symbolic link. Lstat makes no attempt to follow the link.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func Lstat(name string) (fi FileInfo, err error) {
|
||||
func Lstat(name string) (FileInfo, error) {
|
||||
var stat syscall.Stat_t
|
||||
err = syscall.Lstat(name, &stat)
|
||||
err := syscall.Lstat(name, &stat)
|
||||
if err != nil {
|
||||
return nil, &PathError{"lstat", name, err}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue