... is a Go library to simplify working with files and directories. Feel free to use or fork it, if it works for you.
It is intended to be fast to use with a certain degree of flexibility.
A test application for reading and writing data using the different formats supported. Also tests checksum comparisons.
A simple application that can execute another application.
A tool that can list all files and directories contained in a directory. Recursion depth can be limited.
An example that shows how to create a script on the fly, make it executable and execute it.
An example application that acts like ls -lha
with a few extras.
An example that acts like a call to ls
.
Similar to the flat-tree
example, but displays a tree structure instead, just like good ol' tree
.
There are a few cases where the library logs, in those cases it will use the Error
and Panic
functions found in log/main.go
. You can overwrite these functions to handle errors yourself, e.g. to ignore errors:
// silence all logging
log.SetFns(nil, nil)
// no errors, custom panic handler
log.SetFns(nil, func(fmtStr string, args ...any) { panic(fmt.Sprintf("lib died: "+fmtStr, args...)) })
// no panics, custom error handler
log.SetFns(func(err error, fmtStr string, args ...any) (shouldReturn bool) { fmt.Println("Error", err.Error()) ; return err != nil }, nil)