mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
add java cataloger
This commit is contained in:
@@ -82,7 +82,7 @@ func (a *GenericCataloger) Catalog(contents map[file.Reference]string, upstreamM
|
||||
continue
|
||||
}
|
||||
|
||||
entries, err := parser(strings.NewReader(content))
|
||||
entries, err := parser(string(reference.Path), strings.NewReader(content))
|
||||
if err != nil {
|
||||
log.Errorf("cataloger '%s' failed to parse entries (reference=%+v): %w", upstreamMatcher, reference, err)
|
||||
continue
|
||||
|
||||
@@ -39,7 +39,7 @@ func (r *testResolver) FilesByGlob(patterns ...string) ([]file.Reference, error)
|
||||
return []file.Reference{ref}, nil
|
||||
}
|
||||
|
||||
func parser(reader io.Reader) ([]pkg.Package, error) {
|
||||
func parser(_ string, reader io.Reader) ([]pkg.Package, error) {
|
||||
contents, err := ioutil.ReadAll(reader)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -6,5 +6,5 @@ import (
|
||||
"github.com/anchore/imgbom/imgbom/pkg"
|
||||
)
|
||||
|
||||
// ParserFn standardizes a function signature for parser functions that accept file contents and return any discovered packages from that file
|
||||
type ParserFn func(io.Reader) ([]pkg.Package, error)
|
||||
// ParserFn standardizes a function signature for parser functions that accept the virtual file path (not usable for file reads) and contents and return any discovered packages from that file
|
||||
type ParserFn func(string, io.Reader) ([]pkg.Package, error)
|
||||
|
||||
Reference in New Issue
Block a user