Upgrade to Go v1.24 (#16180)

* Upgrade to Go v1.24
* Upgrade golangci-lint

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2025-03-07 11:28:26 +01:00 committed by GitHub
parent f03a9916fe
commit 56929ffa42
9 changed files with 16 additions and 17 deletions

View file

@ -82,7 +82,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: 1.23.x
go-version: 1.24.x
- run: |
$TestTargets = go list ./... | Where-Object { $_ -NotMatch "(github.com/prometheus/prometheus/discovery.*|github.com/prometheus/prometheus/config|github.com/prometheus/prometheus/web)"}
go test $TestTargets -vet=off -v
@ -185,7 +185,7 @@ jobs:
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
cache: false
go-version: 1.23.x
go-version: 1.24.x
- name: Run goyacc and check for diff
run: make install-goyacc check-generated-parser
golangci:
@ -197,7 +197,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: 1.23.x
go-version: 1.24.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
@ -206,7 +206,7 @@ jobs:
with:
args: --verbose
# Make sure to sync this with Makefile.common and scripts/golangci-lint.yml.
version: v1.63.4
version: v1.64.6
fuzzing:
uses: ./.github/workflows/fuzzing.yml
if: github.event_name == 'pull_request'

View file

@ -1,7 +1,7 @@
go:
# Whenever the Go version is updated here,
# .github/workflows should also be updated.
version: 1.23
version: 1.24
repository:
path: github.com/prometheus/prometheus
build:

View file

@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.63.4
GOLANGCI_LINT_VERSION ?= v1.64.6
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

View file

@ -429,11 +429,10 @@ func lexStatements(l *Lexer) stateFn {
l.emit(EQL)
}
case r == '!':
if t := l.next(); t == '=' {
l.emit(NEQ)
} else {
if t := l.next(); t != '=' {
return l.errorf("unexpected character after '!': %q", t)
}
l.emit(NEQ)
case r == '<':
if t := l.peek(); t == '=' {
l.next()

View file

@ -72,7 +72,7 @@ func WithFunctions(functions map[string]*Function) Opt {
}
// NewParser returns a new parser.
func NewParser(input string, opts ...Opt) *parser { //nolint:revive // unexported-return.
func NewParser(input string, opts ...Opt) *parser { //nolint:revive // unexported-return
p := parserPool.Get().(*parser)
p.functions = Functions

View file

@ -28,7 +28,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: 1.23.x
go-version: 1.24.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
@ -36,4 +36,4 @@ jobs:
uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6.2.0
with:
args: --verbose
version: v1.63.4
version: v1.64.6

View file

@ -25,7 +25,7 @@ import (
type multiError []error
// NewMulti returns multiError with provided errors added if not nil.
func NewMulti(errs ...error) multiError { //nolint:revive // unexported-return.
func NewMulti(errs ...error) multiError { //nolint:revive // unexported-return
m := multiError{}
m.Add(errs...)
return m

View file

@ -72,7 +72,7 @@ func (o *OOOChunk) NumSamples() int {
// ToEncodedChunks returns chunks with the samples in the OOOChunk.
//
//nolint:revive // unexported-return.
//nolint:revive // unexported-return
func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error) {
if len(o.samples) == 0 {
return nil, nil

View file

@ -385,7 +385,7 @@ func TestOOOHeadChunkReader_LabelValues(t *testing.T) {
}
}
//nolint:revive // unexported-return.
//nolint:revive // unexported-return
func testOOOHeadChunkReader_LabelValues(t *testing.T, scenario sampleTypeScenario) {
chunkRange := int64(2000)
head, _ := newTestHead(t, chunkRange, wlog.CompressionNone, true)
@ -489,7 +489,7 @@ func TestOOOHeadChunkReader_Chunk(t *testing.T) {
}
}
//nolint:revive // unexported-return.
//nolint:revive // unexported-return
func testOOOHeadChunkReader_Chunk(t *testing.T, scenario sampleTypeScenario) {
opts := DefaultOptions()
opts.OutOfOrderCapMax = 5
@ -900,7 +900,7 @@ func TestOOOHeadChunkReader_Chunk_ConsistentQueryResponseDespiteOfHeadExpanding(
}
}
//nolint:revive // unexported-return.
//nolint:revive // unexported-return
func testOOOHeadChunkReader_Chunk_ConsistentQueryResponseDespiteOfHeadExpanding(t *testing.T, scenario sampleTypeScenario) {
opts := DefaultOptions()
opts.OutOfOrderCapMax = 5