mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
remove type assertion check in packageIdentitiesMatch fn
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
46043510ae
commit
170681943c
@ -269,30 +269,27 @@ func (j *archiveParser) discoverPkgsFromNestedArchives(parentPkg *pkg.Package) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
func packageIdentitiesMatch(p pkg.Package, parentPkg *pkg.Package) bool {
|
func packageIdentitiesMatch(p pkg.Package, parentPkg *pkg.Package) bool {
|
||||||
pkgKey := uniquePkgKey(&p)
|
|
||||||
parentKey := uniquePkgKey(parentPkg)
|
|
||||||
|
|
||||||
// the name/version pair matches...
|
// the name/version pair matches...
|
||||||
matchesParentPkg := pkgKey == parentKey
|
if uniquePkgKey(&p) == uniquePkgKey(parentPkg) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata := p.Metadata.(pkg.JavaMetadata)
|
||||||
|
|
||||||
// the virtual path matches...
|
// the virtual path matches...
|
||||||
matchesParentPkg = matchesParentPkg || parentPkg.Metadata.(pkg.JavaMetadata).VirtualPath == p.Metadata.(pkg.JavaMetadata).VirtualPath
|
if parentPkg.Metadata.(pkg.JavaMetadata).VirtualPath == metadata.VirtualPath {
|
||||||
|
return true
|
||||||
metadata, ok := p.Metadata.(pkg.JavaMetadata)
|
|
||||||
if !ok {
|
|
||||||
return matchesParentPkg
|
|
||||||
}
|
}
|
||||||
pomProperties := metadata.PomProperties
|
|
||||||
|
|
||||||
// the pom artifactId is the parent name
|
// the pom artifactId is the parent name
|
||||||
// note: you CANNOT use name-is-subset-of-artifact-id or vice versa --this is too generic. Shaded jars are a good
|
// note: you CANNOT use name-is-subset-of-artifact-id or vice versa --this is too generic. Shaded jars are a good
|
||||||
// example of this: where the package name is "cloudbees-analytics-segment-driver" and a child is "analytics", but
|
// example of this: where the package name is "cloudbees-analytics-segment-driver" and a child is "analytics", but
|
||||||
// they do not indicate the same package.
|
// they do not indicate the same package.
|
||||||
if pomProperties.ArtifactID != "" {
|
if metadata.PomProperties.ArtifactID != "" && parentPkg.Name == metadata.PomProperties.ArtifactID {
|
||||||
matchesParentPkg = matchesParentPkg || parentPkg.Name == pomProperties.ArtifactID
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return matchesParentPkg
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatePackage(p pkg.Package, parentPkg *pkg.Package) {
|
func updatePackage(p pkg.Package, parentPkg *pkg.Package) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user