Skip to content

Commit 1227e25

Browse files
authored
Merge pull request #1715 from cloudflare/deps
Bump tools
2 parents ae61074 + 8ecde72 commit 1227e25

File tree

18 files changed

+171
-168
lines changed

18 files changed

+171
-168
lines changed

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ linters:
5959
- revive
6060
path: ^internal/parser/utils/
6161
text: "var-naming: avoid meaningless package names"
62+
- linters:
63+
- revive
64+
path: ^internal/log/
65+
text: "var-naming: avoid package names that conflict with Go standard library package names"
66+
- linters:
67+
- revive
68+
path: ^internal/parser/
69+
text: "var-naming: avoid package names that conflict with Go standard library package names"
6270
issues:
6371
max-same-issues: 0
6472
formatters:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/cespare/xxhash/v2 v2.3.0
88
github.com/gkampitakis/go-snaps v0.5.19
99
github.com/google/go-cmp v0.7.0
10-
github.com/google/go-github/v79 v79.0.0
10+
github.com/google/go-github/v82 v82.0.0
1111
github.com/hashicorp/hcl/v2 v2.24.0
1212
github.com/itchyny/json2yaml v0.1.4
1313
github.com/klauspost/compress v1.18.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
9999
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
100100
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
101101
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
102-
github.com/google/go-github/v79 v79.0.0 h1:MdodQojuFPBhmtwHiBcIGLw/e/wei2PvFX9ndxK0X4Y=
103-
github.com/google/go-github/v79 v79.0.0/go.mod h1:OAFbNhq7fQwohojb06iIIQAB9CBGYLq999myfUFnrS4=
102+
github.com/google/go-github/v82 v82.0.0 h1:OH09ESON2QwKCUVMYmMcVu1IFKFoaZHwqYaUtr/MVfk=
103+
github.com/google/go-github/v82 v82.0.0/go.mod h1:hQ6Xo0VKfL8RZ7z1hSfB4fvISg0QqHOqe9BP0qo+WvM=
104104
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
105105
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
106106
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=

internal/checks/promql_series_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ func TestSeriesCheck(t *testing.T) {
32743274
checker: newSeriesCheck,
32753275
prometheus: newSimpleProm,
32763276
otherProms: func(uri string) []*promapi.FailoverGroup {
3277-
var proms []*promapi.FailoverGroup
3277+
proms := make([]*promapi.FailoverGroup, 0, 5)
32783278
for i := range 5 {
32793279
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
32803280
}
@@ -3302,7 +3302,7 @@ func TestSeriesCheck(t *testing.T) {
33023302
checker: newSeriesCheck,
33033303
prometheus: newSimpleProm,
33043304
otherProms: func(uri string) []*promapi.FailoverGroup {
3305-
var proms []*promapi.FailoverGroup
3305+
proms := make([]*promapi.FailoverGroup, 0, 5)
33063306
for i := range 5 {
33073307
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
33083308
}
@@ -3330,7 +3330,7 @@ func TestSeriesCheck(t *testing.T) {
33303330
checker: newSeriesCheck,
33313331
prometheus: newSimpleProm,
33323332
otherProms: func(uri string) []*promapi.FailoverGroup {
3333-
var proms []*promapi.FailoverGroup
3333+
proms := make([]*promapi.FailoverGroup, 0, 15)
33343334
for i := range 15 {
33353335
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
33363336
}
@@ -3368,7 +3368,7 @@ func TestSeriesCheck(t *testing.T) {
33683368
return context.WithValue(ctx, checks.SettingsKey(checks.SeriesCheckName), &s)
33693369
},
33703370
otherProms: func(uri string) []*promapi.FailoverGroup {
3371-
var proms []*promapi.FailoverGroup
3371+
proms := make([]*promapi.FailoverGroup, 0, 15)
33723372
for i := range 15 {
33733373
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), fmt.Sprintf("%s/other/%d", uri, i), time.Second, false))
33743374
}
@@ -3417,7 +3417,7 @@ func TestSeriesCheck(t *testing.T) {
34173417
return context.WithValue(ctx, checks.SettingsKey(checks.SeriesCheckName), &s)
34183418
},
34193419
otherProms: func(uri string) []*promapi.FailoverGroup {
3420-
var proms []*promapi.FailoverGroup
3420+
proms := make([]*promapi.FailoverGroup, 0, 30)
34213421
for i := range 30 {
34223422
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
34233423
}
@@ -3527,7 +3527,7 @@ func TestSeriesCheck(t *testing.T) {
35273527
return context.WithValue(ctx, checks.SettingsKey(checks.SeriesCheckName), &s)
35283528
},
35293529
otherProms: func(uri string) []*promapi.FailoverGroup {
3530-
var proms []*promapi.FailoverGroup
3530+
proms := make([]*promapi.FailoverGroup, 0, 30)
35313531
for i := range 30 {
35323532
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
35333533
}
@@ -3605,7 +3605,7 @@ func TestSeriesCheck(t *testing.T) {
36053605
return context.WithValue(ctx, checks.SettingsKey(checks.SeriesCheckName), &s)
36063606
},
36073607
otherProms: func(uri string) []*promapi.FailoverGroup {
3608-
var proms []*promapi.FailoverGroup
3608+
proms := make([]*promapi.FailoverGroup, 0, 30)
36093609
for i := range 30 {
36103610
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
36113611
}
@@ -3684,9 +3684,9 @@ func TestSeriesCheck(t *testing.T) {
36843684
return context.WithValue(ctx, checks.SettingsKey(checks.SeriesCheckName), &s)
36853685
},
36863686
otherProms: func(uri string) []*promapi.FailoverGroup {
3687-
var proms []*promapi.FailoverGroup
3688-
for i := range 30 {
3689-
proms = append(proms, simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false))
3687+
proms := make([]*promapi.FailoverGroup, 30)
3688+
for i := range proms {
3689+
proms[i] = simpleProm(fmt.Sprintf("prom%d", i), uri+"/other", time.Second, false)
36903690
}
36913691
return proms
36923692
},

internal/config/prometheus.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ func newFailoverGroup(prom PrometheusConfig) *promapi.FailoverGroup {
167167

168168
var tlsConf *tls.Config
169169
tlsConf, _ = prom.TLS.toHTTPConfig()
170-
upstreams := []*promapi.Prometheus{
171-
promapi.NewPrometheus(prom.Name, prom.URI, prom.PublicURI, prom.Headers, timeout, prom.Concurrency, prom.RateLimit, tlsConf),
172-
}
170+
upstreams := make([]*promapi.Prometheus, 0, len(prom.Failover)+1)
171+
upstreams = append(upstreams, promapi.NewPrometheus(prom.Name, prom.URI, prom.PublicURI, prom.Headers, timeout, prom.Concurrency, prom.RateLimit, tlsConf))
173172
for _, uri := range prom.Failover {
174173
upstreams = append(upstreams, promapi.NewPrometheus(prom.Name, uri, prom.PublicURI, prom.Headers, timeout, prom.Concurrency, prom.RateLimit, tlsConf))
175174
}

internal/promapi/failover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ func (fg *FailoverGroup) GetDisabledChecks() map[string][]string {
117117
}
118118

119119
func (fg *FailoverGroup) Include() []string {
120-
sl := []string{}
120+
sl := make([]string, 0, len(fg.pathsInclude))
121121
for _, re := range fg.pathsInclude {
122122
sl = append(sl, re.String())
123123
}
124124
return sl
125125
}
126126

127127
func (fg *FailoverGroup) Exclude() []string {
128-
sl := []string{}
128+
sl := make([]string, 0, len(fg.pathsExclude))
129129
for _, re := range fg.pathsExclude {
130130
sl = append(sl, re.String())
131131
}

internal/promapi/range_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestRange(t *testing.T) {
151151

152152
w.WriteHeader(http.StatusOK)
153153
w.Header().Set("Content-Type", "application/json")
154-
var values []string
154+
values := make([]string, 0, 1)
155155
values = append(values, fmt.Sprintf(`[%d.0,"1"]`, timeParse("2022-06-14T01:00:00Z").Unix()))
156156

157157
_, _ = fmt.Fprintf(w, `{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"instance":"1"}, "values":[%s]}]}}`, strings.Join(values, ","))

internal/reporter/github.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"time"
1111

12-
"github.com/google/go-github/v79/github"
12+
"github.com/google/go-github/v82/github"
1313
"golang.org/x/oauth2"
1414

1515
"github.com/cloudflare/pint/internal/checks"

internal/reporter/github_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/google/go-github/v79/github"
10+
"github.com/google/go-github/v82/github"
1111
"github.com/neilotoole/slogt"
1212
"github.com/stretchr/testify/require"
1313

internal/reporter/reporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (s Summary) Reports() (reports []Report) {
195195
}
196196

197197
func (s Summary) ReportsPerPath() (reports [][]Report) {
198-
curPath := []Report{}
198+
curPath := make([]Report, 0, len(s.reports))
199199
for _, r := range s.reports {
200200
if len(curPath) > 0 && curPath[0].Path.Name != r.Path.Name {
201201
reports = append(reports, curPath)

0 commit comments

Comments
 (0)