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> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
37 lines
709 B
Go
37 lines
709 B
Go
package licenses
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
)
|
|
|
|
func (s *scanner) FindEvidence(_ context.Context, reader io.Reader) (evidence []Evidence, content []byte, err error) {
|
|
if s.scanner == nil {
|
|
return nil, nil, nil
|
|
}
|
|
|
|
content, err = io.ReadAll(reader)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
cov := s.scanner(content)
|
|
if cov.Percent < s.coverageThreshold {
|
|
// unknown or no licenses here
|
|
// => check return content to Search to process
|
|
return nil, content, nil
|
|
}
|
|
|
|
evidence = make([]Evidence, 0)
|
|
for _, m := range cov.Match {
|
|
evidence = append(evidence, Evidence{
|
|
ID: m.ID,
|
|
Type: m.Type,
|
|
Start: m.Start,
|
|
End: m.End,
|
|
IsURL: m.IsURL,
|
|
})
|
|
}
|
|
return evidence, content, nil
|
|
}
|