Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 34218db

Browse files
committed
Fix return type
1 parent 3b704e7 commit 34218db

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sbom/upload.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func Upload(sb *types.Sbom, workspace string, apikey string) error {
4949
}
5050

5151
newTransaction := context.NewTransaction
52-
_, err := transactSbom(sb, newTransaction)
52+
err := transactSbom(sb, newTransaction)
5353
if err != nil {
5454
return errors.Wrap(err, "failed to transact image")
5555
}
@@ -70,19 +70,19 @@ func Send(sb *types.Sbom, entities chan<- string) error {
7070
entities <- entitiesString
7171
})
7272
}
73-
_, err := transactSbom(sb, newTransaction)
73+
err := transactSbom(sb, newTransaction)
7474
if err != nil {
7575
return errors.Wrap(err, "failed to transact image")
7676
}
7777

7878
return nil
7979
}
8080

81-
func transactSbom(sb *types.Sbom, newTransaction func() skill.Transaction) (*ImageEntity, error) {
81+
func transactSbom(sb *types.Sbom, newTransaction func() skill.Transaction) error {
8282
now := time.Now()
8383
host, name, err := parseReference(sb)
8484
if err != nil {
85-
return nil, errors.Wrap(err, "failed to obtain host and repository")
85+
return errors.Wrap(err, "failed to obtain host and repository")
8686
}
8787
config := (*sb).Source.Image.Config
8888
manifest := (*sb).Source.Image.Manifest
@@ -176,7 +176,7 @@ func transactSbom(sb *types.Sbom, newTransaction func() skill.Transaction) (*Ima
176176
// transact the image with all its metadata (repo, tags, layers, blobs, ports, env etc)
177177
err = transaction.AddEntities(image, platform).Transact()
178178
if err != nil {
179-
return nil, errors.Wrapf(err, "failed to transact image")
179+
return errors.Wrapf(err, "failed to transact image")
180180
}
181181

182182
// transact all packages in chunks
@@ -226,22 +226,22 @@ func transactSbom(sb *types.Sbom, newTransaction func() skill.Transaction) (*Ima
226226
image.Dependencies = &skill.ManyRef{Add: transaction.EntityRefs("package/dependency")}
227227
err := transaction.AddEntities(image).Transact()
228228
if err != nil {
229-
return nil, errors.Wrapf(err, "failed to transact packages")
229+
return errors.Wrapf(err, "failed to transact packages")
230230
}
231231
}
232232

233233
image = skill.MakeEntity(ImageEntity{
234234
Digest: sb.Source.Image.Digest,
235235
SbomState: Indexed,
236-
}, "$repo")
236+
}, "$image")
237237
if sb.Artifacts != nil {
238238
image.SbomState = Indexed
239239
}
240240
err = newTransaction().Ordered().AddEntities(image).Transact()
241241
if err != nil {
242-
return nil, errors.Wrapf(err, "failed to transact packages")
242+
return errors.Wrapf(err, "failed to transact packages")
243243
}
244-
return &image, nil
244+
return nil
245245
}
246246

247247
func digestChainIds(manifest *v1.Manifest) []digest.Digest {

0 commit comments

Comments
 (0)