From 2bf947d45e5841fdb9567d59bcc451a9522c8acf Mon Sep 17 00:00:00 2001 From: zongz Date: Thu, 17 Oct 2024 15:56:26 +0800 Subject: [PATCH] fix: fix typo Signed-off-by: zongz --- pkg/downloader/cache.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/downloader/cache.go b/pkg/downloader/cache.go index d3681741..31687734 100644 --- a/pkg/downloader/cache.go +++ b/pkg/downloader/cache.go @@ -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 } @@ -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 }