mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 16:06:36 +01:00
Performance improvements around package ID (#698)
* set package ID in catalogers and improve hashing performance Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update setting ID + tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -7,8 +7,8 @@ type CargoMetadata struct {
|
||||
}
|
||||
|
||||
// Pkgs returns all of the packages referenced within the Cargo.lock metadata.
|
||||
func (m CargoMetadata) Pkgs() []pkg.Package {
|
||||
pkgs := make([]pkg.Package, 0)
|
||||
func (m CargoMetadata) Pkgs() []*pkg.Package {
|
||||
pkgs := make([]*pkg.Package, 0)
|
||||
|
||||
for _, p := range m.Packages {
|
||||
if p.Dependencies == nil {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
var _ common.ParserFn = parseCargoLock
|
||||
|
||||
// parseCargoLock is a parser function for Cargo.lock contents, returning all rust cargo crates discovered.
|
||||
func parseCargoLock(_ string, reader io.Reader) ([]pkg.Package, []artifact.Relationship, error) {
|
||||
func parseCargoLock(_ string, reader io.Reader) ([]*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: %v", err)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestParseCargoLock(t *testing.T) {
|
||||
expected := []pkg.Package{
|
||||
expected := []*pkg.Package{
|
||||
{
|
||||
Name: "ansi_term",
|
||||
Version: "0.12.1",
|
||||
|
||||
Reference in New Issue
Block a user