add java cataloger

This commit is contained in:
Alex Goodman
2020-07-08 16:16:01 -04:00
parent e040fc8930
commit e55db9247e
95 changed files with 2120 additions and 45 deletions
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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)