Documentation
¶
Overview ¶
Package sbom is the application-layer service behind `pf sbom` - extraction internal/app/doctor already did for `pf doctor`. cmd/platform-factory/sbom.go now only parses flags, calls Service, and formats the result (text vs JSON is a presentation concern, so it stays in the CLI layer); path collection and SBOM generation live here, testable without going through the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
Document is re-exported so callers of this package never need to import internal/sbom directly.
type Service ¶
type Service struct {
// Stat reports file info for a path - normally os.Stat.
Stat func(name string) (os.FileInfo, error)
// WalkDir walks a directory tree - normally filepath.WalkDir.
WalkDir func(root string, fn fs.WalkDirFunc) error
}
Service holds every dependency CollectPaths needs, injectable so tests never touch the real filesystem.
func (Service) CollectPaths ¶
CollectPaths maps each argument to component entries: a regular file becomes one component keyed by its cleaned path, a directory contributes every regular file it contains, keyed by path. Keying by on-disk path keeps component names unique across arguments and makes the sorted output deterministic. Non-regular entries (symlinks, device nodes, sockets) are skipped, since only regular files have content to hash and classify.
func (Service) Generate ¶
Generate produces the SBOM document for the given path set (as returned by CollectPaths): each component records the file's sha256 digest, size, detected kind, and native ELF dependencies. It uses no external tools, so the inventory is available on hosts without syft and is byte-for-byte deterministic (components are sorted by name).