Package ifchanged is a collection of Go functions to perform callbacks in case of file changes (using sha256 hash)
and / or missing files.
Use case: Generating css file only if scss file has changed or css file is missing.
err = ifchanged.NewIf().
Changed(fileName, fileName+".sha256").
Missing("somefile.txt").
Execute(func() error {
fmt.Printf("This has been called because \"somefile.txt\" is missing or %v has changed\n", fileName)
return nil
})pkg.go.dev/github.com/zzwx/ifchanged
- go 1.13
ifchanged, additionally, has a way to provide checksums using a DB interface.
linetuple.gocontains a simple file-based implementation ofDB(not really optimised yet)- git.mills.io/prologic/bitcask implements it.