From 03378e976cd4ee32b0d46fec99421f2880fed3c8 Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Fri, 25 Sep 2020 16:20:06 -0400 Subject: [PATCH] always return a cleanup function from scope (#183) Signed-off-by: Alex Goodman --- syft/scope/scope.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syft/scope/scope.go b/syft/scope/scope.go index f32624d6e..b0cb796af 100644 --- a/syft/scope/scope.go +++ b/syft/scope/scope.go @@ -54,11 +54,11 @@ func NewScope(userInput string, o Option) (Scope, func(), error) { case directoryScheme: fileMeta, err := fs.Stat(location) if err != nil { - return Scope{}, nil, fmt.Errorf("unable to stat dir=%q: %w", location, err) + return Scope{}, func() {}, fmt.Errorf("unable to stat dir=%q: %w", location, err) } if !fileMeta.IsDir() { - return Scope{}, nil, fmt.Errorf("given path is not a directory (path=%q): %w", location, err) + return Scope{}, func() {}, fmt.Errorf("given path is not a directory (path=%q): %w", location, err) } s, err := NewScopeFromDir(location)