Skip to content

Commit

Permalink
fix: --cache-dir broken after in 0.19.3+ (#1382)
Browse files Browse the repository at this point in the history
Resolves #1378 where `--cache-dir` was broken after in 0.19.3+ due to a
regression in #1327. This error happened because `cacheDir` is not an
absolute path when provided via the CLI option. This PR fixes the bug by
resolving `cacheDir` to an absolute path when initializing the `cache`
instance.

Signed-off-by: Luke Young <[email protected]>
  • Loading branch information
lyoung-confluent authored Nov 7, 2024
1 parent 81ff6a3 commit 818ff3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/apk/apk/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ func WithCache(cacheDir string, offline bool, shared *Cache) Option {
return err
}
cacheDir = filepath.Join(cacheDir, "dev.chainguard.go-apk")
} else {
cacheDir, err = filepath.Abs(cacheDir)
if err != nil {
return err
}
}
o.cache = &cache{
dir: cacheDir,
Expand Down

0 comments on commit 818ff3c

Please sign in to comment.