@@ -128,36 +128,6 @@ func gobExploitToModel(g GobExploit) models.Exploit {
128128 }
129129}
130130
131- // --- Malicious package conversions ---
132-
133- func maliciousComponentToGob (c models.MaliciousAffectedComponent ) GobMaliciousComponent {
134- return GobMaliciousComponent {
135- ID : c .ID ,
136- MaliciousPackageID : c .MaliciousPackageID ,
137- PurlWithoutVersion : c .PurlWithoutVersion ,
138- Ecosystem : c .Ecosystem ,
139- Version : c .Version ,
140- SemverIntroduced : c .SemverIntroduced ,
141- SemverFixed : c .SemverFixed ,
142- VersionIntroduced : c .VersionIntroduced ,
143- VersionFixed : c .VersionFixed ,
144- }
145- }
146-
147- func gobComponentToModel (g GobMaliciousComponent ) models.MaliciousAffectedComponent {
148- return models.MaliciousAffectedComponent {
149- ID : g .ID ,
150- MaliciousPackageID : g .MaliciousPackageID ,
151- PurlWithoutVersion : g .PurlWithoutVersion ,
152- Ecosystem : g .Ecosystem ,
153- Version : g .Version ,
154- SemverIntroduced : g .SemverIntroduced ,
155- SemverFixed : g .SemverFixed ,
156- VersionIntroduced : g .VersionIntroduced ,
157- VersionFixed : g .VersionFixed ,
158- }
159- }
160-
161131func writeGobFileItems [T any ](items []T , fileName string ) error {
162132 gobFile , err := os .Create (fileName )
163133 if err != nil {
@@ -244,16 +214,17 @@ func readGobFileStream[T any](ctx context.Context, path string, handleItems func
244214 case <- ctx .Done ():
245215 return ctx .Err ()
246216 default :
247- handleItems (batch )
217+ if err := handleItems (batch ); err != nil {
218+ return fmt .Errorf ("could not handle batch of items from gob file %s: %w" , path , err )
219+ }
248220 }
249221 batch = batch [:0 ]
250222 }
251223 }
252224 if len (batch ) > 0 {
253225 select {
254226 default :
255- handleItems (batch )
256- return nil
227+ return handleItems (batch )
257228 case <- ctx .Done ():
258229 return ctx .Err ()
259230 }
0 commit comments