MCPcopy Create free account
hub / github.com/cli/cli / lstat

Function lstat

pkg/cmd/repo/read-file/read_file.go:240–249  ·  view source on GitHub ↗

lstat is a simplified abstraction around [os.Lstat] that reports whether the path is a directory or a symlink, using Lstat so that a symlink at the path is not followed.

(path string)

Source from the content-addressed store, hash-verified

238// path is a directory or a symlink, using Lstat so that a symlink at the path
239// is not followed.
240func lstat(path string) (*lstatResult, error) {
241 info, err := os.Lstat(path)
242 if err != nil {
243 return nil, err
244 }
245 return &lstatResult{
246 isDir: info.IsDir(),
247 isSymlink: info.Mode()&os.ModeSymlink != 0,
248 }, nil
249}
250
251// These indirect the file system operations used when writing output, so tests can
252// substitute them without touching the real file system.

Callers

nothing calls this directly

Calls 2

IsDirMethod · 0.80
ModeMethod · 0.80

Tested by

no test coverage detected