Skip to content

Commit

Permalink
fix: fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <zongzhe1024@163.com>
  • Loading branch information
zong-zhe committed Oct 17, 2024
1 parent a51c5a1 commit 2bf947d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/downloader/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ type PkgCache struct {

// Update updates the cache with the source.
func (p *PkgCache) Update(source Source, updateFunc func(cachePath string) error) error {
hashedPath, err := source.GenCachePath()
cachePath, err := source.GenCachePath()
if err != nil {
return err
}

if err := updateFunc(filepath.Join(p.cacheDir, hashedPath)); err != nil {
if err := updateFunc(filepath.Join(p.cacheDir, cachePath)); err != nil {
return err
}

Expand All @@ -61,11 +61,19 @@ func (p *PkgCache) Find(source Source) (string, error) {

// Remove removes the source from the cache.
func (p *PkgCache) Remove(source Source) error {
hashedPath, err := source.GenCachePath()
cachePath, err := source.GenCachePath()
if err != nil {
return err
}
if err := os.RemoveAll(filepath.Join(p.cacheDir, hashedPath)); err != nil {
if err := os.RemoveAll(filepath.Join(p.cacheDir, cachePath)); err != nil {
return err
}

srcCachePath, err := source.GenSrcCachePath()
if err != nil {
return err
}
if err := os.RemoveAll(filepath.Join(p.cacheDir, srcCachePath)); err != nil {
return err
}

Expand Down

0 comments on commit 2bf947d

Please sign in to comment.