Skip to content

Commit b0264af

Browse files
authored
Merge pull request #1621 from cloudflare/entries
Use pointers for Entry
2 parents 7ee4d85 + 1ecb1c2 commit b0264af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+229
-229
lines changed

cmd/pint/ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func actionCI(ctx context.Context, c *cli.Command) error {
106106
schema := parseSchema(meta.cfg.Parser.Schema)
107107
names := parseNames(meta.cfg.Parser.Names)
108108
allowedOwners := meta.cfg.Owners.CompileAllowed()
109-
var entries []discovery.Entry
109+
var entries []*discovery.Entry
110110
entries, err = discovery.NewGlobFinder([]string{"*"}, filter, schema, names, allowedOwners).Find()
111111
if err != nil {
112112
return err

cmd/pint/lint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func actionLint(ctx context.Context, c *cli.Command) error {
197197
return nil
198198
}
199199

200-
func verifyOwners(entries []discovery.Entry, allowedOwners []*regexp.Regexp) (reports []reporter.Report) {
200+
func verifyOwners(entries []*discovery.Entry, allowedOwners []*regexp.Regexp) (reports []reporter.Report) {
201201
for _, entry := range entries {
202202
if entry.State == discovery.Removed {
203203
continue

cmd/pint/scan.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/cloudflare/pint/internal/reporter"
1515
)
1616

17-
func checkRules(ctx context.Context, workers int, isOffline bool, gen *config.PrometheusGenerator, cfg config.Config, entries []discovery.Entry) (summary reporter.Summary, err error) {
17+
func checkRules(ctx context.Context, workers int, isOffline bool, gen *config.PrometheusGenerator, cfg config.Config, entries []*discovery.Entry) (summary reporter.Summary, err error) {
1818
slog.LogAttrs(ctx, slog.LevelInfo, "Checking Prometheus rules", slog.Int("entries", len(entries)), slog.Int("workers", workers), slog.Bool("online", !isOffline))
1919
if isOffline {
2020
slog.LogAttrs(ctx, slog.LevelInfo, "Offline mode, skipping Prometheus discovery")
@@ -143,8 +143,8 @@ func checkRules(ctx context.Context, workers int, isOffline bool, gen *config.Pr
143143

144144
type scanJob struct {
145145
check checks.RuleChecker
146-
allEntries []discovery.Entry
147-
entry discovery.Entry
146+
entry *discovery.Entry
147+
allEntries []*discovery.Entry
148148
}
149149

150150
func scanWorker(ctx context.Context, jobs <-chan scanJob, results chan<- reporter.Report) {

internal/checks/alerts_absent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (c AlertsAbsentCheck) Reporter() string {
5454
return AlertsAbsentCheckName
5555
}
5656

57-
func (c AlertsAbsentCheck) Check(ctx context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
57+
func (c AlertsAbsentCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
5858
if entry.Rule.AlertingRule == nil {
5959
return problems
6060
}

internal/checks/alerts_annotation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (c AnnotationCheck) Reporter() string {
6767
return AnnotationCheckName
6868
}
6969

70-
func (c AnnotationCheck) Check(_ context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
70+
func (c AnnotationCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
7171
if entry.Rule.AlertingRule == nil {
7272
return nil
7373
}

internal/checks/alerts_comparison.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (c ComparisonCheck) Reporter() string {
4444
return ComparisonCheckName
4545
}
4646

47-
func (c ComparisonCheck) Check(_ context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
47+
func (c ComparisonCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
4848
if entry.Rule.AlertingRule == nil {
4949
return problems
5050
}

internal/checks/alerts_count.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c AlertsCheck) Reporter() string {
6464
return AlertsCheckName
6565
}
6666

67-
func (c AlertsCheck) Check(ctx context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
67+
func (c AlertsCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
6868
if entry.Rule.AlertingRule == nil {
6969
return problems
7070
}

internal/checks/alerts_external_labels.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (c AlertsExternalLabelsCheck) Reporter() string {
4747
return AlertsExternalLabelsCheckName
4848
}
4949

50-
func (c AlertsExternalLabelsCheck) Check(ctx context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
50+
func (c AlertsExternalLabelsCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
5151
if entry.Rule.AlertingRule == nil {
5252
return problems
5353
}

internal/checks/alerts_for.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (c AlertsForChecksFor) Reporter() string {
4343
return AlertForCheckName
4444
}
4545

46-
func (c AlertsForChecksFor) Check(_ context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
46+
func (c AlertsForChecksFor) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
4747
if entry.Rule.AlertingRule == nil {
4848
return problems
4949
}

internal/checks/alerts_template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (c TemplateCheck) Reporter() string {
112112
return TemplateCheckName
113113
}
114114

115-
func (c TemplateCheck) Check(ctx context.Context, entry discovery.Entry, _ []discovery.Entry) (problems []Problem) {
115+
func (c TemplateCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem) {
116116
if entry.Rule.AlertingRule == nil {
117117
return nil
118118
}

0 commit comments

Comments
 (0)