Documentation ¶
Index ¶
- func Abs(v string) (string, error)
- func Base(src string) string
- func Clean(src string) string
- func Dir(path string) string
- func DirPath(src string) string
- func Ext(src string) string
- func IsAbs(path string) bool
- func IsLocal(path string) bool
- func Join(v ...string) string
- func Split(src string) (dir string, file string)
- func Walk(root string, fn WalkFunc, opts ...walker.Option) error
- func WalkWithContext(ctx context.Context, root string, fn WalkFunc, opts ...walker.Option) error
- func WithErrorCallback(call WalkCallback) walker.Option
- type WalkCallback
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir returns all but the last element of path, typically the path's directory. After dropping the final element, Dir calls Clean on the path and trailing slashes are removed. If the path is empty, Dir returns ".". If the path consists entirely of separators, Dir returns a single separator. The returned path does not end in a separator unless it is the root directory.
func Ext ¶
Ext returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final element of path; it is empty if there is no dot.
func Split ¶
Split splits path immediately following the final Separator, separating it into a directory and file name component. If there is no Separator in path, Split returns an empty dir and file set to path.
The returned values have the property that path = dir+file.
func WalkWithContext ¶ added in v1.20.0
WalkWithContext walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.
If fastWalk returns filepath.SkipDir, the directory is skipped.
Multiple goroutines stat the filesystem concurrently. The provided walkFn must be safe for concurrent use.
func WithErrorCallback ¶ added in v1.20.0
func WithErrorCallback(call WalkCallback) walker.Option
WithErrorCallback sets a callback to be used for error handling. Any error returned will halt the Walk function and return the error. If the callback returns nil Walk will continue.