swap format readseekers for readers (#2581)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2024-02-01 14:18:13 -05:00 committed by GitHub
parent 6107e5e2ad
commit 5a9b664fef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 10 deletions

View file

@ -28,11 +28,11 @@ func Decoders() []sbom.FormatDecoder {
}
// Identify takes a set of bytes and attempts to identify the format of the SBOM.
func Identify(reader io.ReadSeeker) (sbom.FormatID, string) {
func Identify(reader io.Reader) (sbom.FormatID, string) {
return staticDecoders.Identify(reader)
}
// Decode takes a set of bytes and attempts to decode it into an SBOM.
func Decode(reader io.ReadSeeker) (*sbom.SBOM, sbom.FormatID, string, error) {
func Decode(reader io.Reader) (*sbom.SBOM, sbom.FormatID, string, error) {
return staticDecoders.Decode(reader)
}

View file

@ -276,18 +276,14 @@ func TestSelectName(t *testing.T) {
expected: "atlassian-gadgets-api",
},
{
desc: "Filename has period that is not groupid + artifact id",
manifest: pkg.JavaManifest{
Main: map[string]string{},
},
desc: "Filename has period that is not groupid + artifact id",
manifest: pkg.JavaManifest{},
archive: newJavaArchiveFilename("/something/http4s-crypto_2.12-0.1.0.jar"),
expected: "http4s-crypto_2.12",
},
{
desc: "Filename has period that is not groupid + artifact id, kafka",
manifest: pkg.JavaManifest{
Main: map[string]string{},
},
desc: "Filename has period that is not groupid + artifact id, kafka",
manifest: pkg.JavaManifest{},
archive: newJavaArchiveFilename("/something//kafka_2.13-3.2.2.jar"),
expected: "kafka_2.13", // see https://mvnrepository.com/artifact/org.apache.kafka/kafka_2.13/3.2.2
},