Skip to content

Commit 62456b2

Browse files
committed
Revert to default spec dirs if none are specified
Instead of accepting an empty list of spec dirs, we explicitly revert to the default spec dirs to ensure that we don't configure a cache with no spec dirs specified. Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 5528737 commit 62456b2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

pkg/cdi/spec-dirs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ var (
4343

4444
// WithSpecDirs returns an option to override the CDI Spec directories.
4545
func WithSpecDirs(dirs ...string) Option {
46+
// If no spec dirs are specified use the default spec dirs.
47+
if len(dirs) == 0 {
48+
return WithSpecDirs(DefaultSpecDirs...)
49+
}
4650
return func(c *Cache) {
4751
specDirs := make([]string, len(dirs))
4852
for i, dir := range dirs {

0 commit comments

Comments
 (0)