Merge pull request #13108 from mmorel-35/patch-2

tsdb/chunkenc: use Go standard errors package
This commit is contained in:
Julien Pivotto 2023-11-14 00:54:35 +01:00 committed by GitHub
commit b718dca70b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View file

@ -14,11 +14,10 @@
package chunkenc
import (
"fmt"
"math"
"sync"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/histogram"
)
@ -293,7 +292,7 @@ func (p *pool) Get(e Encoding, b []byte) (Chunk, error) {
c.b.count = 0
return c, nil
}
return nil, errors.Errorf("invalid chunk encoding %q", e)
return nil, fmt.Errorf("invalid chunk encoding %q", e)
}
func (p *pool) Put(c Chunk) error {
@ -332,7 +331,7 @@ func (p *pool) Put(c Chunk) error {
sh.b.count = 0
p.floatHistogram.Put(c)
default:
return errors.Errorf("invalid chunk encoding %q", c.Encoding())
return fmt.Errorf("invalid chunk encoding %q", c.Encoding())
}
return nil
}
@ -349,7 +348,7 @@ func FromData(e Encoding, d []byte) (Chunk, error) {
case EncFloatHistogram:
return &FloatHistogramChunk{b: bstream{count: 0, stream: d}}, nil
}
return nil, errors.Errorf("invalid chunk encoding %q", e)
return nil, fmt.Errorf("invalid chunk encoding %q", e)
}
// NewEmptyChunk returns an empty chunk for the given encoding.
@ -362,5 +361,5 @@ func NewEmptyChunk(e Encoding) (Chunk, error) {
case EncFloatHistogram:
return NewFloatHistogramChunk(), nil
}
return nil, errors.Errorf("invalid chunk encoding %q", e)
return nil, fmt.Errorf("invalid chunk encoding %q", e)
}

View file

@ -14,9 +14,8 @@
package chunkenc
import (
"fmt"
"math/bits"
"github.com/pkg/errors"
)
// putVarbitInt writes an int64 using varbit encoding with a bit bucketing
@ -109,7 +108,7 @@ func readVarbitInt(b *bstreamReader) (int64, error) {
val = int64(bits)
default:
return 0, errors.Errorf("invalid bit pattern %b", d)
return 0, fmt.Errorf("invalid bit pattern %b", d)
}
if sz != 0 {
@ -215,7 +214,7 @@ func readVarbitUint(b *bstreamReader) (uint64, error) {
return 0, err
}
default:
return 0, errors.Errorf("invalid bit pattern %b", d)
return 0, fmt.Errorf("invalid bit pattern %b", d)
}
if sz != 0 {