mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
25 lines
551 B
Go
25 lines
551 B
Go
package cyclonedxhelpers
|
|
|
|
import "github.com/anchore/syft/syft/pkg"
|
|
|
|
func encodeDescription(p pkg.Package) string {
|
|
if hasMetadata(p) {
|
|
switch metadata := p.Metadata.(type) {
|
|
case pkg.ApkMetadata:
|
|
return metadata.Description
|
|
case pkg.NpmPackageJSONMetadata:
|
|
return metadata.Description
|
|
}
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func decodeDescription(description string, metadata interface{}) {
|
|
switch meta := metadata.(type) {
|
|
case *pkg.ApkMetadata:
|
|
meta.Description = description
|
|
case *pkg.NpmPackageJSONMetadata:
|
|
meta.Description = description
|
|
}
|
|
}
|