port dotnet cataloger to new generic cataloger pattern (#1286)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2022-10-24 21:17:27 +00:00
committed by GitHub
parent fbdde6d4f4
commit c7a653060d
8 changed files with 230 additions and 136 deletions
+6 -7
View File
@@ -1,14 +1,13 @@
package dotnet
import (
"github.com/anchore/syft/syft/pkg/cataloger/common"
"github.com/anchore/syft/syft/pkg/cataloger/generic"
)
// NewDotnetDepsCataloger returns a new Dotnet cataloger object base on deps json files.
func NewDotnetDepsCataloger() *common.GenericCataloger {
globParsers := map[string]common.ParserFn{
"**/*.deps.json": parseDotnetDeps,
}
const catalogerName = "dotnet-deps-cataloger"
return common.NewGenericCataloger(nil, globParsers, "dotnet-deps-cataloger")
// NewDotnetDepsCataloger returns a new Dotnet cataloger object base on deps json files.
func NewDotnetDepsCataloger() *generic.Cataloger {
return generic.NewCataloger(catalogerName).
WithParserByGlobs(parseDotnetDeps, "**/*.deps.json")
}