Skip to content

Commit cf212e4

Browse files
committed
Update Go
* Update minimum Go version to 1.24.0. * Update Go to 1.25. * Run Go modernize tool. Signed-off-by: SuperQ <superq@gmail.com>
1 parent 969c00d commit cf212e4

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ executors:
77
# also be updated.
88
golang:
99
docker:
10-
- image: cimg/go:1.23
10+
- image: cimg/go:1.25
1111
jobs:
1212
test:
1313
executor: golang

.promu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
go:
22
# This must match .circle/config.yml.
3-
version: 1.23
3+
version: 1.25
44
repository:
55
path: github.com/prometheus-community/bind_exporter
66
build:

bind/json/json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func NewClient(url string, c *http.Client) *Client {
8888
// Get queries the given path and stores the result in the value pointed to by
8989
// v. The endpoint must return a valid JSON representation which can be
9090
// unmarshaled into the provided value.
91-
func (c *Client) Get(p string, v interface{}) error {
91+
func (c *Client) Get(p string, v any) error {
9292
u, err := url.Parse(c.url)
9393
if err != nil {
9494
return fmt.Errorf("invalid URL %q: %s", c.url, err)

bind/xml/xml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func NewClient(url string, c *http.Client) *Client {
103103
// Get queries the given path and stores the result in the value pointed to by
104104
// v. The endpoint must return a valid XML representation which can be
105105
// unmarshaled into the provided value.
106-
func (c *Client) Get(p string, v interface{}) error {
106+
func (c *Client) Get(p string, v any) error {
107107
u, err := url.Parse(c.url)
108108
if err != nil {
109109
return fmt.Errorf("invalid URL %q: %s", c.url, err)

bind_exporter.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"net/http"
2121
_ "net/http/pprof"
2222
"os"
23+
"slices"
2324
"sort"
2425
"strconv"
2526
"strings"
@@ -504,7 +505,7 @@ func (s *statisticGroups) Set(value string) error {
504505
return nil
505506
}
506507
var sg bind.StatisticGroup
507-
for _, dt := range strings.Split(value, ",") {
508+
for dt := range strings.SplitSeq(value, ",") {
508509
switch dt {
509510
case string(bind.ServerStats):
510511
sg = bind.ServerStats
@@ -515,10 +516,8 @@ func (s *statisticGroups) Set(value string) error {
515516
default:
516517
return fmt.Errorf("unknown stats group %q", dt)
517518
}
518-
for _, existing := range *s {
519-
if existing == sg {
520-
return fmt.Errorf("duplicated stats group %q", sg)
521-
}
519+
if slices.Contains(*s, sg) {
520+
return fmt.Errorf("duplicated stats group %q", sg)
522521
}
523522
*s = append(*s, sg)
524523
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/prometheus-community/bind_exporter
22

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/alecthomas/kingpin/v2 v2.4.0

0 commit comments

Comments
 (0)