1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build aix darwin dragonfly freebsd hurd js,wasm linux nacl netbsd openbsd solaris
13 // Stat returns the FileInfo structure describing file.
14 // If there is an error, it will be of type *PathError.
15 func (f *File) Stat() (FileInfo, error) {
17 return nil, ErrInvalid
20 err := f.pfd.Fstat(&fs.sys)
22 return nil, &PathError{"stat", f.name, err}
24 fillFileStatFromSys(&fs, f.name)
28 // statNolog stats a file with no test logging.
29 func statNolog(name string) (FileInfo, error) {
31 err := syscall.Stat(name, &fs.sys)
33 return nil, &PathError{"stat", name, err}
35 fillFileStatFromSys(&fs, name)
39 // lstatNolog lstats a file with no test logging.
40 func lstatNolog(name string) (FileInfo, error) {
42 err := syscall.Lstat(name, &fs.sys)
44 return nil, &PathError{"lstat", name, err}
46 fillFileStatFromSys(&fs, name)