mirror of
https://github.com/anchore/syft.git
synced 2025-11-20 09:53:16 +01:00
22 lines
453 B
Go
22 lines
453 B
Go
package rust
|
|
|
|
import "github.com/anchore/syft/syft/pkg"
|
|
|
|
type CargoMetadata struct {
|
|
Packages []pkg.CargoPackageMetadata `toml:"package"`
|
|
}
|
|
|
|
// Pkgs returns all of the packages referenced within the Cargo.lock metadata.
|
|
func (m CargoMetadata) Pkgs() []pkg.Package {
|
|
pkgs := make([]pkg.Package, 0)
|
|
|
|
for _, p := range m.Packages {
|
|
if p.Dependencies == nil {
|
|
p.Dependencies = make([]string, 0)
|
|
}
|
|
pkgs = append(pkgs, p.Pkg())
|
|
}
|
|
|
|
return pkgs
|
|
}
|