mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
--------- Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
19 lines
388 B
Go
19 lines
388 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, error) {
|
|
if s, ok := ctx.Value(licenseScannerKey{}).(Scanner); ok {
|
|
return s, nil
|
|
}
|
|
return NewDefaultScanner()
|
|
}
|