plumb context through catalogers (#2528)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2024-01-22 15:54:51 -05:00
committed by GitHub
parent c5d15d1d6c
commit cdad5e767a
78 changed files with 226 additions and 144 deletions
@@ -1,6 +1,7 @@
package rust
import (
"context"
"errors"
rustaudit "github.com/microsoft/go-rustaudit"
@@ -14,7 +15,7 @@ import (
)
// Catalog identifies executables then attempts to read Rust dependency information from them
func parseAuditBinary(_ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
func parseAuditBinary(_ context.Context, _ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
var pkgs []pkg.Package
unionReader, err := unionreader.GetUnionReader(reader.ReadCloser)
+2 -1
View File
@@ -1,6 +1,7 @@
package rust
import (
"context"
"fmt"
"github.com/pelletier/go-toml"
@@ -18,7 +19,7 @@ type cargoLockFile struct {
}
// parseCargoLock is a parser function for Cargo.lock contents, returning all rust cargo crates discovered.
func parseCargoLock(_ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
func parseCargoLock(_ context.Context, _ file.Resolver, _ *generic.Environment, reader file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
tree, err := toml.LoadReader(reader)
if err != nil {
return nil, nil, fmt.Errorf("unable to load Cargo.lock for parsing: %w", err)