multi: fix fmt.Errorf error wrapping

Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
This commit is contained in:
ffranr
2024-02-26 11:19:38 +00:00
parent 581c16d72f
commit cd566eb097
103 changed files with 426 additions and 390 deletions

View File

@@ -157,10 +157,10 @@ func compactAndSwap(cfg *BoltBackendConfig) error {
// temporary DB file and close it before we write the new DB to it.
tempFile, err := os.Create(tempDestFilePath)
if err != nil {
return fmt.Errorf("unable to create temp DB file: %v", err)
return fmt.Errorf("unable to create temp DB file: %w", err)
}
if err := tempFile.Close(); err != nil {
return fmt.Errorf("unable to close file: %v", err)
return fmt.Errorf("unable to close file: %w", err)
}
// With the file created, we'll start the compaction and remove the
@@ -178,7 +178,7 @@ func compactAndSwap(cfg *BoltBackendConfig) error {
}
initialSize, newSize, err := c.execute()
if err != nil {
return fmt.Errorf("error during compact: %v", err)
return fmt.Errorf("error during compact: %w", err)
}
log.Infof("DB compaction of %v successful, %d -> %d bytes (gain=%.2fx)",

View File

@@ -115,7 +115,7 @@ func (cmd *compacter) execute() (int64, int64, error) {
// Run compaction.
if err := cmd.compact(dst, src); err != nil {
return 0, 0, fmt.Errorf("error running compaction: %v", err)
return 0, 0, fmt.Errorf("error running compaction: %w", err)
}
// Report stats on new size.