mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
always return a cleanup function from scope (#183)
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
576fbc898b
commit
03378e976c
@ -54,11 +54,11 @@ func NewScope(userInput string, o Option) (Scope, func(), error) {
|
|||||||
case directoryScheme:
|
case directoryScheme:
|
||||||
fileMeta, err := fs.Stat(location)
|
fileMeta, err := fs.Stat(location)
|
||||||
if err != nil {
|
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() {
|
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)
|
s, err := NewScopeFromDir(location)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user