MCPcopy Index your code
hub / github.com/coder/coder / isRegular

Function isRegular

cli/dotfiles.go:371–381  ·  view source on GitHub ↗

isRegular detects if the file exists and is not a symlink.

(to string)

Source from the content-addressed store, hash-verified

369
370// isRegular detects if the file exists and is not a symlink.
371func isRegular(to string) (bool, error) {
372 fi, err := os.Lstat(to)
373 if err != nil {
374 if errors.Is(err, os.ErrNotExist) {
375 return false, nil
376 }
377 return false, xerrors.Errorf("lstat %s: %w", to, err)
378 }
379
380 return fi.Mode().IsRegular(), nil
381}

Callers 1

dotfilesMethod · 0.85

Calls 2

IsMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected