Documentation ¶
Index ¶
- func CheckPath(path string) error
- func CloseFile(file *os.File) error
- func CreateAllDir(path string) error
- func CreateAllDirIfNotExist(path string) error
- func CreateBuildDirIfNotExist(buildDir string) error
- func CreateFile(path string, content []byte) (*os.File, error)
- func CurrentAbsolutePath(relPath string) (string, error)
- func CurrentRootPath() (string, error)
- func FileChecksum(path string) (string, error)
- func IsCreate(ev fsnotify.Event) bool
- func IsDir(path string) (bool, error)
- func IsRemove(ev fsnotify.Event) bool
- func IsWrite(ev fsnotify.Event) bool
- func OpenFile(path string) (*os.File, error)
- func ReadFile(path string) ([]byte, error)
- func RelPath(root string, path string) (string, error)
- func RemoveAllDir(path string) error
- func RemoveFile(filePath string) error
- func RemoveFileIfExist(path string) error
- func RemoveRootBuildDir(relBuildDir string) error
- func RemoveRootDir(relPath string) error
- func WithLock(mu *sync.Mutex, f func())
- func WithLockAndError(mu *sync.Mutex, f func() error) error
- func WriteFile(file *os.File, content []byte) error
- type Batcher
- type FileChecksums
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAllDir ¶
CreateAllDir creates all directories up to the path provided
func CreateAllDirIfNotExist ¶
CreateAllDirIfNotExist creates all directories if they do not already exist up to the path provided
func CreateBuildDirIfNotExist ¶
CreateBuildDirIfNotExist creates the build directory if it does not already exist
func CreateFile ¶
CreateFile creates a file with the given content at the path provided
func CurrentAbsolutePath ¶
CurrentAbsolutePath is a absolute representation of the relative path provided by taking the current root path into account
func CurrentRootPath ¶
CurrentRootPath is the current root path
func FileChecksum ¶
FileChecksum calculates a new checksum for the given path
func RemoveAllDir ¶
RemoveAllDir removes all directories up to the path provided
func RemoveFile ¶
RemoveFile removes a file at the path provided
func RemoveFileIfExist ¶
RemoveFileIfExist removes a file if it does already exist at the path provided
func RemoveRootBuildDir ¶
RemoveRootBuildDir removes the given build dir at it's root
func RemoveRootDir ¶
RemoveRootDir removes all directories up to the relative path provided
func WithLockAndError ¶
WithLockAndError runs the given operation in a blocking manner and returns any errors
Types ¶
type Batcher ¶
type Batcher struct { *fsnotify.Watcher Events chan []fsnotify.Event Errors chan []error // contains filtered or unexported fields }
Batcher collects detected file changes throughout a given time interval.
func NewBatcher ¶
NewBatcher creates and runs a Batcher with the given time interval.
type FileChecksums ¶
type FileChecksums struct {
// contains filtered or unexported fields
}
FileChecksums is a thread-safe map that stores file checksums
func NewFileChecksums ¶
func NewFileChecksums() *FileChecksums
NewFileChecksums creates a new file checksums map
func (*FileChecksums) HasChanged ¶
func (c *FileChecksums) HasChanged(path string, checksum string) bool
HasChanged checks if the checksum for the given path has changed in a thread safe manner
func (*FileChecksums) UpdateFileChecksum ¶
func (c *FileChecksums) UpdateFileChecksum(path string, checksum string)
UpdateFileChecksum updates the checksum for the given path in a thread-safe manner