refactor: remove useless error check for scan data export job (#20883)

Signed-off-by: chlins <chlins.zhang@gmail.com>
Co-authored-by: miner <yminer@vmware.com>
This commit is contained in:
Chlins Zhang 2024-08-30 11:59:27 +08:00 committed by GitHub
parent 234cd4ffc2
commit 9d11de9706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,20 +180,17 @@ func (sde *ScanDataExport) updateExecAttributes(ctx job.Context, params job.Para
}
func (sde *ScanDataExport) writeCsvFile(ctx job.Context, params job.Parameters, fileName string) error {
csvFile, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_APPEND, os.ModePerm)
if err != nil {
return err
}
systemContext := ctx.SystemContext()
defer csvFile.Close()
logger := ctx.GetLogger()
csvFile, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_APPEND, os.ModePerm)
if err != nil {
logger.Errorf("Failed to create CSV export file %s. Error : %v", fileName, err)
return err
}
defer csvFile.Close()
logger.Infof("Created CSV export file %s", csvFile.Name())
systemContext := ctx.SystemContext()
var exportParams export.Params
var artIDGroups [][]int64