github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/format/internal/cyclonedxutil/helpers/description.go (about) 1 package helpers 2 3 import "github.com/anchore/syft/syft/pkg" 4 5 func encodeDescription(p pkg.Package) string { 6 if hasMetadata(p) { 7 switch metadata := p.Metadata.(type) { 8 case pkg.ApkDBEntry: 9 return metadata.Description 10 case pkg.NpmPackage: 11 return metadata.Description 12 } 13 } 14 return "" 15 } 16 17 func decodeDescription(description string, metadata interface{}) { 18 switch meta := metadata.(type) { 19 case *pkg.ApkDBEntry: 20 meta.Description = description 21 case *pkg.NpmPackage: 22 meta.Description = description 23 } 24 }