Join errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2024-05-27 17:14:17 +02:00
parent 7b56353090
commit f3b8750339
1 changed files with 7 additions and 6 deletions

View File

@ -16,6 +16,7 @@ package promql
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
@ -93,14 +94,14 @@ type mmapedFile struct {
func (f *mmapedFile) Close() error {
err := f.m.Unmap()
if fErr := f.f.Close(); fErr != nil && err == nil {
return fmt.Errorf("close mmapedFile.f: %w", fErr)
if err != nil {
err = fmt.Errorf("mmapedFile: unmapping: %w", err)
}
if fErr := f.f.Close(); fErr != nil {
return errors.Join(fmt.Errorf("close mmapedFile.f: %w", fErr), err)
}
if err != nil {
return fmt.Errorf("mmapedFile: unmapping: %w", err)
}
return nil
return err
}
func getMMapedFile(filename string, filesize int, logger log.Logger) ([]byte, io.Closer, error) {