(ctx context.Context, d string)
| 50 | } |
| 51 | |
| 52 | func clearCacheDirectory(ctx context.Context, d string) error { |
| 53 | log(ctx).Infof("Clearing cache directory: %v.", d) |
| 54 | |
| 55 | err := retry.WithExponentialBackoffNoValue(ctx, "delete cache", func() error { |
| 56 | return os.RemoveAll(d) |
| 57 | }, retry.Always) |
| 58 | if err != nil { |
| 59 | return errors.Wrap(err, "error removing cache directory") |
| 60 | } |
| 61 | |
| 62 | if err := os.MkdirAll(d, cache.DirMode); err != nil { |
| 63 | return errors.Wrap(err, "error creating cache directory") |
| 64 | } |
| 65 | |
| 66 | return nil |
| 67 | } |
no test coverage detected