Documentation
¶
Overview ¶
Package filesystem implements things like moving files, copying them, etc.
Package filesystem / git implements git-related commands
Index ¶
- Variables
- func AnyFileNewerThan(path string, givenTime time.Time) (bool, error)
- func CheckFileExists(path string) error
- func CopyDir(pathSource, pathDestination string) error
- func CopyFile(pathSource, pathDestination string) error
- func DirTree(root string) ([]string, error)
- func Filenamify(name string, extension string) string
- func GetFileModTime(filePath string) (time.Time, error)
- func GitDescribe(repoPath string) (string, error)
- func GitDescribeCoreboot(repoPath string) (string, error)
- func LoadLastRunTime(pathLastRun string) (time.Time, error)
- func MoveFile(pathSource, pathDestination string) error
- func SaveCurrentRunTime(pathLastRun string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyPath is returned when function is called with empty path parameter ErrEmptyPath = errors.New("provided path is empty") // ErrPathIsDirectory is returned when path exists, but is a directory and not a file ErrPathIsDirectory = fmt.Errorf("provided path is directory: %w", os.ErrExist) // ErrFileNotRegular is returned when path exists, but is not a regular file ErrFileNotRegular = errors.New("file is not regular file") // ErrFileModified is returned when a file in given path was modified ErrFileModified = errors.New("file has been modified since") )
var ErrNotGitRepository = errors.New("not a git repository")
ErrNotGitRepository is returned when a git command is executed outside of git repository
Functions ¶
func AnyFileNewerThan ¶
AnyFileNewerThan checks recursively if any file in given path (can be directory or file) has modification time newer than the given time. Returns: - true if a newer file is found - false if no newer file is found or givenTime is zero Function is lazy, and returns on first positive occurrence.
func CheckFileExists ¶
CheckFileExists checks if file exists at PATH
func Filenamify ¶
Filenamify converts a string to a valid and safe filename
func GetFileModTime ¶
GetFileModTime returns modification time of a file
func GitDescribe ¶
GitDescribe is a generic git describe command, with some sane defaults
func GitDescribeCoreboot ¶
GitDescribeCoreboot is coreboot-specific git describe command (do not touch)
func LoadLastRunTime ¶
LoadLastRunTime loads time of the last execution from file
func SaveCurrentRunTime ¶
SaveCurrentRunTime writes the current time into file
Types ¶
This section is empty.