mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Join errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
parent
7b56353090
commit
f3b8750339
|
@ -16,6 +16,7 @@ package promql
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
@ -93,14 +94,14 @@ type mmapedFile struct {
|
||||||
|
|
||||||
func (f *mmapedFile) Close() error {
|
func (f *mmapedFile) Close() error {
|
||||||
err := f.m.Unmap()
|
err := f.m.Unmap()
|
||||||
if fErr := f.f.Close(); fErr != nil && err == nil {
|
if err != nil {
|
||||||
return fmt.Errorf("close mmapedFile.f: %w", fErr)
|
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 err
|
||||||
return fmt.Errorf("mmapedFile: unmapping: %w", err)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMMapedFile(filename string, filesize int, logger log.Logger) ([]byte, io.Closer, error) {
|
func getMMapedFile(filename string, filesize int, logger log.Logger) ([]byte, io.Closer, error) {
|
||||||
|
|
Loading…
Reference in a new issue