diff --git a/pkg/distro/apk/apk.go b/pkg/distro/apk/apk.go index 1c9fff0..b8d0abd 100644 --- a/pkg/distro/apk/apk.go +++ b/pkg/distro/apk/apk.go @@ -162,7 +162,7 @@ func ParsePackage(input, output, author, organization, license string) error { sfile := &spdx.File{ Entity: spdx.Entity{ - Name: "/" + hdr.Name, + FileName: "/" + hdr.Name, Checksum: map[string]string{ "SHA1": hex.EncodeToString(cksumSHA1[:]), "SHA256": hex.EncodeToString(cksumSHA256[:]), diff --git a/pkg/distro/deb/deb.go b/pkg/distro/deb/deb.go index d594b49..8e75cfa 100644 --- a/pkg/distro/deb/deb.go +++ b/pkg/distro/deb/deb.go @@ -101,7 +101,7 @@ func ParsePackage(input, output, author, organization, license string) error { sfile := &spdx.File{ Entity: spdx.Entity{ - Name: hdr.Name[1:], + FileName: hdr.Name[1:], Checksum: map[string]string{ "SHA1": hex.EncodeToString(cksumSHA1[:]), "SHA256": hex.EncodeToString(cksumSHA256[:]), diff --git a/pkg/distro/rpm/rpm.go b/pkg/distro/rpm/rpm.go index 38beb30..5f1e886 100644 --- a/pkg/distro/rpm/rpm.go +++ b/pkg/distro/rpm/rpm.go @@ -145,7 +145,7 @@ func ParsePackage(input, output, author, organization, license string) error { sfile.LicenseInfoInFile = pkglicense sfile.SetEntity( &spdx.Entity{ - Name: finfo.Name(), + FileName: finfo.Name(), Checksum: map[string]string{ "SHA1": hex.EncodeToString(cksumSHA1[:]), "SHA256": hex.EncodeToString(cksumSHA256[:]), diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index c895bf7..a54bf5a 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -142,7 +142,7 @@ func BuildPackageFromDir(input string, kdoc *k8spdx.Document, kpkg *k8spdx.Packa kfile := k8spdx.NewFile() kfile.SetEntity( &k8spdx.Entity{ - Name: path, + FileName: path, Checksum: map[string]string{ "SHA1": hex.EncodeToString(cksumSHA1[:]), "SHA256": hex.EncodeToString(cksumSHA256[:]), @@ -292,7 +292,7 @@ func BuildPackageFromFile(input string, kpkg *k8spdx.Package, license string) er kfile := k8spdx.NewFile() kfile.SetEntity( &k8spdx.Entity{ - Name: input, + FileName: input, Checksum: map[string]string{ "SHA1": hex.EncodeToString(cksumSHA1[:]), "SHA256": hex.EncodeToString(cksumSHA256[:]), diff --git a/pkg/fs/verify.go b/pkg/fs/verify.go index cf65792..cc86154 100644 --- a/pkg/fs/verify.go +++ b/pkg/fs/verify.go @@ -32,21 +32,21 @@ func checkBOM(input, pathEntry string) error { for _, pkg := range doc.Packages { for _, file := range pkg.Files() { - symlink, err := filepath.EvalSymlinks(file.Name) + symlink, err := filepath.EvalSymlinks(file.FileName) if err != nil { - log.Error().Err(err).Str("path", file.Name).Str("package", pkg.Name).Msg("unable to resolve symlink") + log.Error().Err(err).Str("path", file.FileName).Str("package", pkg.Name).Msg("unable to resolve symlink") return err } - if file.Name != pathEntry && symlink != pathEntry { + if file.FileName != pathEntry && symlink != pathEntry { continue } file.Entity.Opts = &spdx.ObjectOptions{} - if err := file.ReadSourceFile(file.Name); err != nil { - log.Error().Err(err).Str("path", file.Name).Msg("doesn't match entry in SBOM document") + if err := file.ReadSourceFile(file.FileName); err != nil { + log.Error().Err(err).Str("path", file.FileName).Msg("doesn't match entry in SBOM document") return err } @@ -58,9 +58,9 @@ func checkBOM(input, pathEntry string) error { } for _, file := range doc.Files { - symlink, err := filepath.EvalSymlinks(file.Name) + symlink, err := filepath.EvalSymlinks(file.FileName) if err != nil { - log.Error().Err(err).Str("path", file.Name).Msg("unable to resolve symlink") + log.Error().Err(err).Str("path", file.FileName).Msg("unable to resolve symlink") return err } @@ -126,7 +126,7 @@ func Verify(input, inventory, missing string) error { sfile := spdx.NewFile() sfile.SetEntity( &spdx.Entity{ - Name: entry.Path, + FileName: entry.Path, Checksum: map[string]string{"SHA256": strings.Split(entry.Checksum, ":")[1]}, }, )