mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 06:56:40 +01:00
23 lines
399 B
Go
23 lines
399 B
Go
package helpers
|
|
|
|
import (
|
|
"github.com/anchore/syft/syft/source"
|
|
)
|
|
|
|
func DocumentName(src source.Description) string {
|
|
if src.Name != "" {
|
|
return src.Name
|
|
}
|
|
|
|
switch metadata := src.Metadata.(type) {
|
|
case source.ImageMetadata:
|
|
return metadata.UserInput
|
|
case source.DirectoryMetadata:
|
|
return metadata.Path
|
|
case source.FileMetadata:
|
|
return metadata.Path
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|