Skip to content

Commit d0f97e2

Browse files
committed
Update supported Go versions
Now that 1.23 is out, update the supported version matrix to Go 1.21 through 1.23. This allows us to start using `log/slog`. * Update generated tests. Signed-off-by: SuperQ <[email protected]>
1 parent ffc4cc6 commit d0f97e2

15 files changed

+323
-425
lines changed

.github/workflows/go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: Run style and unused
5656
uses: dagger/dagger-for-github@v6
57-
if: ${{ matrix.go_version == '1.20' }}
57+
if: ${{ matrix.go_version == '1.21' }}
5858
with:
5959
version: "latest"
6060
verb: call

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install Go
2929
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
3030
with:
31-
go-version: 1.22.x
31+
go-version: 1.23.x
3232
- name: Install snmp_exporter/generator dependencies
3333
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3434
if: github.repository == 'prometheus/snmp_exporter'

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ This is the [Go](http://golang.org) client library for
1010
instrumenting application code, and one for creating clients that talk to the
1111
Prometheus HTTP API.
1212

13-
**This library requires Go1.20 or later.**
14-
> The library mandates the use of Go1.20 or subsequent versions. While it has demonstrated functionality with versions as old as Go 1.17, our commitment remains to offer support and rectifications for only the most recent three major releases.
13+
**This library requires Go1.21 or later.**
14+
> The library mandates the use of Go1.21 or subsequent versions. While it has demonstrated functionality with versions as old as Go 1.17, our commitment remains to offer support and rectifications for only the most recent three major releases.
1515
1616
## Important note about releases and stability
1717

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/prometheus/client_golang
22

3-
go 1.20
3+
go 1.21
44

55
require (
66
github.com/beorn7/perks v1.0.1

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
4141
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
4242
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
4343
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
44+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
4445
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4546
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
4647
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
48+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
4749
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
4850
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
4951
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
@@ -56,6 +58,8 @@ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6h
5658
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
5759
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5860
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
61+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
5962
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
6063
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
6164
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
65+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

prometheus/collectors/go_collector_go117_test.go

-110
This file was deleted.

prometheus/collectors/go_collector_go119_test.go

-128
This file was deleted.

prometheus/collectors/go_collector_go121_test.go

-27
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package collectors
1818

19-
import "sort"
20-
2119
func withAllMetrics() []string {
2220
return withBaseMetrics([]string{
2321
"go_cgo_go_to_c_calls_calls_total",
@@ -171,28 +169,3 @@ func withDebugMetrics() []string {
171169
"go_godebug_non_default_behavior_zipinsecurepath_events_total",
172170
})
173171
}
174-
175-
var defaultRuntimeMetrics = []string{
176-
"go_gc_gogc_percent",
177-
"go_gc_gomemlimit_bytes",
178-
"go_sched_gomaxprocs_threads",
179-
}
180-
181-
func withDefaultRuntimeMetrics(metricNames []string, withoutGC, withoutSched bool) []string {
182-
if withoutGC && withoutSched {
183-
// If both flags are true, return the metricNames as is.
184-
return metricNames
185-
} else if withoutGC && !withoutSched {
186-
// If only withoutGC is true, include "go_sched_gomaxprocs_threads" only.
187-
metricNames = append(metricNames, []string{"go_sched_gomaxprocs_threads"}...)
188-
} else if withoutSched && !withoutGC {
189-
// If only withoutSched is true, exclude "go_sched_gomaxprocs_threads".
190-
metricNames = append(metricNames, []string{"go_gc_gogc_percent", "go_gc_gomemlimit_bytes"}...)
191-
} else {
192-
// If neither flag is true, use the default metrics.
193-
metricNames = append(metricNames, defaultRuntimeMetrics...)
194-
}
195-
// sorting is required
196-
sort.Strings(metricNames)
197-
return metricNames
198-
}

prometheus/collectors/go_collector_go122_test.go

-27
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package collectors
1818

19-
import "sort"
20-
2119
func withAllMetrics() []string {
2220
return withBaseMetrics([]string{
2321
"go_cgo_go_to_c_calls_calls_total",
@@ -193,28 +191,3 @@ func withDebugMetrics() []string {
193191
"go_godebug_non_default_behavior_zipinsecurepath_events_total",
194192
})
195193
}
196-
197-
var defaultRuntimeMetrics = []string{
198-
"go_gc_gogc_percent",
199-
"go_gc_gomemlimit_bytes",
200-
"go_sched_gomaxprocs_threads",
201-
}
202-
203-
func withDefaultRuntimeMetrics(metricNames []string, withoutGC, withoutSched bool) []string {
204-
if withoutGC && withoutSched {
205-
// If both flags are true, return the metricNames as is.
206-
return metricNames
207-
} else if withoutGC && !withoutSched {
208-
// If only withoutGC is true, include "go_sched_gomaxprocs_threads" only.
209-
metricNames = append(metricNames, []string{"go_sched_gomaxprocs_threads"}...)
210-
} else if withoutSched && !withoutGC {
211-
// If only withoutSched is true, exclude "go_sched_gomaxprocs_threads".
212-
metricNames = append(metricNames, []string{"go_gc_gogc_percent", "go_gc_gomemlimit_bytes"}...)
213-
} else {
214-
// If neither flag is true, use the default metrics.
215-
metricNames = append(metricNames, defaultRuntimeMetrics...)
216-
}
217-
// sorting is required
218-
sort.Strings(metricNames)
219-
return metricNames
220-
}

0 commit comments

Comments
 (0)