mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
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:
@@ -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)",
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user