github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/gosbom/formats/common/spdxhelpers/description.go (about) 1 package spdxhelpers 2 3 import "github.com/nextlinux/gosbom/gosbom/pkg" 4 5 func Description(p pkg.Package) string { 6 if hasMetadata(p) { 7 switch metadata := p.Metadata.(type) { 8 case pkg.ApkMetadata: 9 return metadata.Description 10 case pkg.NpmPackageJSONMetadata: 11 return metadata.Description 12 } 13 } 14 return "" 15 } 16 17 func hasMetadata(p pkg.Package) bool { 18 return p.Metadata != nil 19 }