Source file src/os/stat.go
1 // Copyright 2017 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. 4 5 package os 6 7 import "internal/testlog" 8 9 // Stat returns a [FileInfo] describing the named file. 10 // If there is an error, it will be of type [*PathError]. 11 func Stat(name string) (FileInfo, error) { 12 testlog.Stat(name) 13 return statNolog(name) 14 } 15 16 // Lstat returns a [FileInfo] describing the named file. 17 // If the file is a symbolic link, the returned FileInfo 18 // describes the symbolic link. Lstat makes no attempt to follow the link. 19 // If there is an error, it will be of type [*PathError]. 20 // 21 // On Windows, if the file is a reparse point that is a surrogate for another 22 // named entity (such as a symbolic link or mounted folder), the returned 23 // FileInfo describes the reparse point, and makes no attempt to resolve it. 24 func Lstat(name string) (FileInfo, error) { 25 testlog.Stat(name) 26 return lstatNolog(name) 27 } 28