Asking whether a path holds a file or a directory is a constant need in
command-line programs, and the standard library only offers os.Stat plus an
error test, which people regularly get wrong by treating every error as "not
there" or by forgetting that a directory is not a file. The repo already has Mkdirp and CopyFile, so these two belong in the same drawer.
Definition of done: FileExists(path string) bool reports whether the path
exists and is a regular file, and DirExists(path string) bool reports whether
it exists and is a directory, with both returning false for anything they
cannot look at. They have doc comments and table-driven tests, run against a
temporary directory, covering an existing file, an existing directory, a path
that does not exist, a path whose parent does not exist, and an empty path.
Model: opus-5
Asking whether a path holds a file or a directory is a constant need in
command-line programs, and the standard library only offers `os.Stat` plus an
error test, which people regularly get wrong by treating every error as "not
there" or by forgetting that a directory is not a file. The repo already has
`Mkdirp` and `CopyFile`, so these two belong in the same drawer.
Definition of done: `FileExists(path string) bool` reports whether the path
exists and is a regular file, and `DirExists(path string) bool` reports whether
it exists and is a directory, with both returning false for anything they
cannot look at. They have doc comments and table-driven tests, run against a
temporary directory, covering an existing file, an existing directory, a path
that does not exist, a path whose parent does not exist, and an empty path.
Model: opus-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Asking whether a path holds a file or a directory is a constant need in
command-line programs, and the standard library only offers
os.Statplus anerror test, which people regularly get wrong by treating every error as "not
there" or by forgetting that a directory is not a file. The repo already has
MkdirpandCopyFile, so these two belong in the same drawer.Definition of done:
FileExists(path string) boolreports whether the pathexists and is a regular file, and
DirExists(path string) boolreports whetherit exists and is a directory, with both returning false for anything they
cannot look at. They have doc comments and table-driven tests, run against a
temporary directory, covering an existing file, an existing directory, a path
that does not exist, a path whose parent does not exist, and an empty path.
Model: opus-5