mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 05:04:05 -08:00
Address golint failures from revive
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
1c624c58ca
commit
73255e15f6
2
.github/workflows/golangci-lint.yml
vendored
2
.github/workflows/golangci-lint.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
|||
- "**.go"
|
||||
- "scripts/errcheck_excludes.txt"
|
||||
- ".github/workflows/golangci-lint.yml"
|
||||
- ".golangci.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "go.sum"
|
||||
|
@ -14,6 +15,7 @@ on:
|
|||
- "**.go"
|
||||
- "scripts/errcheck_excludes.txt"
|
||||
- ".github/workflows/golangci-lint.yml"
|
||||
- ".golangci.yml"
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
|
|
|
@ -170,7 +170,7 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName
|
|||
}
|
||||
}
|
||||
default:
|
||||
return errors.New(fmt.Sprintf("rule result is wrong type %s", val.Type().String()))
|
||||
return fmt.Errorf("rule result is wrong type %s", val.Type().String())
|
||||
}
|
||||
|
||||
if err := app.flushAndCommit(ctx); err != nil {
|
||||
|
|
|
@ -233,6 +233,7 @@ func TestBackfillLabels(t *testing.T) {
|
|||
},
|
||||
}
|
||||
ruleImporter, err := newTestRuleImporter(ctx, start, tmpDir, mockAPISamples, defaultBlockDuration)
|
||||
require.NoError(t, err)
|
||||
|
||||
path := filepath.Join(tmpDir, "test.file")
|
||||
recordingRules := `groups:
|
||||
|
|
|
@ -188,7 +188,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
|||
case "cn":
|
||||
endpointFormat = "https://%s:%d/v%d/gz/discover"
|
||||
default:
|
||||
return nil, errors.New(fmt.Sprintf("unknown role '%s' in configuration", d.sdConfig.Role))
|
||||
return nil, fmt.Errorf("unknown role '%s' in configuration", d.sdConfig.Role)
|
||||
}
|
||||
var endpoint = fmt.Sprintf(endpointFormat, d.sdConfig.Endpoint, d.sdConfig.Port, d.sdConfig.Version)
|
||||
if len(d.sdConfig.Groups) > 0 {
|
||||
|
@ -223,7 +223,7 @@ func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
|||
case "cn":
|
||||
return d.processComputeNodeResponse(data, endpoint)
|
||||
default:
|
||||
return nil, errors.New(fmt.Sprintf("unknown role '%s' in configuration", d.sdConfig.Role))
|
||||
return nil, fmt.Errorf("unknown role '%s' in configuration", d.sdConfig.Role)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
type multiError []error
|
||||
|
||||
// NewMulti returns multiError with provided errors added if not nil.
|
||||
func NewMulti(errs ...error) multiError { // nolint:golint
|
||||
func NewMulti(errs ...error) multiError { // nolint:revive
|
||||
m := multiError{}
|
||||
m.Add(errs...)
|
||||
return m
|
||||
|
|
|
@ -284,7 +284,7 @@ func (ce *CircularExemplarStorage) Resize(l int64) int {
|
|||
// This math is essentially looking at nextIndex, where we would write the next exemplar to,
|
||||
// and find the index in the old exemplar buffer that we should start migrating exemplars from.
|
||||
// This way we don't migrate exemplars that would just be overwritten when migrating later exemplars.
|
||||
var startIndex int64 = (oldNextIndex - count + int64(len(oldBuffer))) % int64(len(oldBuffer))
|
||||
var startIndex = (oldNextIndex - count + int64(len(oldBuffer))) % int64(len(oldBuffer))
|
||||
|
||||
for i := int64(0); i < count; i++ {
|
||||
idx := (startIndex + i) % int64(len(oldBuffer))
|
||||
|
|
|
@ -875,7 +875,7 @@ type segmentBufReader struct {
|
|||
off int // Offset of read data into current segment.
|
||||
}
|
||||
|
||||
// nolint:golint // TODO: Consider exporting segmentBufReader
|
||||
// nolint:revive // TODO: Consider exporting segmentBufReader
|
||||
func NewSegmentBufReader(segs ...*Segment) *segmentBufReader {
|
||||
return &segmentBufReader{
|
||||
buf: bufio.NewReaderSize(segs[0], 16*pageSize),
|
||||
|
@ -883,7 +883,7 @@ func NewSegmentBufReader(segs ...*Segment) *segmentBufReader {
|
|||
}
|
||||
}
|
||||
|
||||
// nolint:golint
|
||||
// nolint:revive
|
||||
func NewSegmentBufReaderWithOffset(offset int, segs ...*Segment) (sbr *segmentBufReader, err error) {
|
||||
if offset == 0 {
|
||||
return NewSegmentBufReader(segs...), nil
|
||||
|
|
Loading…
Reference in a new issue