Documentation ¶
Overview ¶
Package fsutil provides filesystem-related functions.
Index ¶
- Constants
- func CommonFileMode(fi fs.FileInfo) fs.FileMode
- func CopyDir(src, dest string) error
- func CopyFSToDisk(src fs.FS, destDir string, modeSetter func(fs.FileInfo) os.FileMode) error
- func CopyFile(src, dest string) error
- func Gopath() string
- func UntarBundle(destination string, source string) error
Constants ¶
const ( // DirMode is the default permission used when creating directories DirMode = 0755 // FileMode is the default permission used when creating files FileMode = 0644 )
Variables ¶
This section is empty.
Functions ¶
func CommonFileMode ¶
CommonFileMode is a function that returns the common file permissions: 0644 for all files, and 0755 for all directories. It is provided as a helper for CopyFSToDisk's common use case
func CopyDir ¶
CopyDir is a utility to assist with copying a directory from src to dest. Note that directory permissions are not maintained, but the permissions of the files in those directories are.
func CopyFSToDisk ¶
CopyFSToDisk copies an embedded FS to a given directory. Because go's embed does not preserve the file mode, you must also pass a function that will return the desired file mode for each file.
func CopyFile ¶
CopyFile is a utility to assist with copying a file from src to dest. Note that file permissions are maintained.
func Gopath ¶
func Gopath() string
Gopath will return the current GOPATH as set by environment variables and will fall back to ~/go if a GOPATH is not set.
func UntarBundle ¶
UntarBundle will untar a source tar.gz archive to the supplied destination. Note that this calls `filepath.Dir(destination)`, which has the effect of stripping the last component from destination.
Types ¶
This section is empty.