mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* add single license scanner instance Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * rename testing license scanner Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
19 lines
374 B
Go
19 lines
374 B
Go
package licenses
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type licenseScannerKey struct{}
|
|
|
|
func SetContextLicenseScanner(ctx context.Context, s Scanner) context.Context {
|
|
return context.WithValue(ctx, licenseScannerKey{}, s)
|
|
}
|
|
|
|
func ContextLicenseScanner(ctx context.Context) Scanner {
|
|
if s, ok := ctx.Value(licenseScannerKey{}).(Scanner); ok {
|
|
return s
|
|
}
|
|
return NewDefaultScanner()
|
|
}
|