String types for path manipulation.
- you can treat paths exactly like strings
- String subtypes prevent common mix-ups: the go compiler will warn you about passing a string that could represent a file to a function that accepts a
pathlib.Dir
argument. - Each string subtype can have associated methods, consolidating functionality from
"path/filepath"
,"os"
, and"io/fs"
Inspired by Python's pathlib
and Go's filesystem methods scattered throughout the stdlib.
There are plenty of other ports of pathlib
to go, but only one other package one other uses string types to represent paths.
Using this library adds some overhead compared to using the stdlib functions directly.
Rough measurements on my x86_64 machine indicated that linking pathlib
adds around a kilobyte to the size of a binary that does nothing except links path/filepath
.