added gotch.CleanCache API
This commit is contained in:
parent
cd7cc90d02
commit
8eab6a5bbd
|
@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
- Added `gotch.CleanCache()` API.
|
||||
|
||||
## [Nofix]
|
||||
- ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box.
|
||||
|
|
11
file-util.go
11
file-util.go
|
@ -287,3 +287,14 @@ func copyFile(src, dst string) error {
|
|||
_, err = io.Copy(destination, source)
|
||||
return err
|
||||
}
|
||||
|
||||
// CleanCache removes all files cached at `CacheDir`
|
||||
func CleanCache() error {
|
||||
err := os.RemoveAll(CacheDir)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("CleanCache() failed: %w", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user