From 3ba0482332c2162396fad4552ac2ca8dea88d709 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 23 Jul 2024 17:03:42 -0400 Subject: [PATCH] Update to Go 1.22.5 (#40082) * Update to go 1.22.4. * Link to PR. * Fix bad merge. * Fix some regex. * Fix config_test.go * Comment out ping. * Update to go 1.22.5. * Un-comment code. * Update go.mod. * Add encrypt=false to mssql py test. * Make CI happy * Fix NOTICE.txt. --------- Co-authored-by: subham sarkar Co-authored-by: Julien Lind (cherry picked from commit c0f8ae3b257b13cd80036c8da9e1d607444572bd) --- .go-version | 2 +- .golangci.yml | 8 ++++---- CHANGELOG.next.asciidoc | 2 ++ auditbeat/Dockerfile | 2 +- auditbeat/module/file_integrity/config_test.go | 6 +++--- dev-tools/kubernetes/filebeat/Dockerfile.debug | 2 +- dev-tools/kubernetes/heartbeat/Dockerfile.debug | 2 +- dev-tools/kubernetes/metricbeat/Dockerfile.debug | 2 +- dev-tools/mage/crossbuild.go | 2 +- go.mod | 4 +--- heartbeat/Dockerfile | 2 +- libbeat/docs/version.asciidoc | 2 +- libbeat/processors/actions/drop_fields_test.go | 2 +- metricbeat/Dockerfile | 2 +- metricbeat/module/http/_meta/Dockerfile | 2 +- metricbeat/module/nats/_meta/Dockerfile | 2 +- metricbeat/module/vsphere/_meta/Dockerfile | 2 +- packetbeat/Dockerfile | 2 +- x-pack/functionbeat/Dockerfile | 2 +- .../metricbeat/module/mssql/_meta/supported-versions.yml | 2 +- x-pack/metricbeat/module/mssql/docker-compose.yml | 4 ++-- x-pack/metricbeat/module/stan/_meta/Dockerfile | 2 +- 22 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.go-version b/.go-version index 26d7b6e756e0..da9594fd66f3 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.21.12 +1.22.5 diff --git a/.golangci.yml b/.golangci.yml index 70aae1d462c8..481435ee271d 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -124,7 +124,7 @@ linters-settings: gosimple: # Select the Go version to target. The default is '1.13'. - go: "1.21.12" + go: "1.22.5" nakedret: # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 @@ -142,19 +142,19 @@ linters-settings: staticcheck: # Select the Go version to target. The default is '1.13'. - go: "1.21.12" + go: "1.22.5" checks: ["all"] stylecheck: # Select the Go version to target. The default is '1.13'. - go: "1.21.12" + go: "1.22.5" # Disabled: # ST1005: error strings should not be capitalized checks: ["all", "-ST1005"] unused: # Select the Go version to target. The default is '1.13'. - go: "1.21.12" + go: "1.22.5" gosec: excludes: diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index cd81cd32fff3..5dc80e7816f9 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -10,6 +10,8 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] *Affecting all Beats* +- Update Go version to 1.22.5. {pull}40082[40082] + *Auditbeat* diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index 910945115a38..f81aac4e5be5 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 RUN \ apt-get update \ diff --git a/auditbeat/module/file_integrity/config_test.go b/auditbeat/module/file_integrity/config_test.go index 0372b23a282d..6104a01cfb8a 100644 --- a/auditbeat/module/file_integrity/config_test.go +++ b/auditbeat/module/file_integrity/config_test.go @@ -54,10 +54,10 @@ func TestConfig(t *testing.T) { assert.EqualValues(t, 1024*1024*1024, c.MaxFileSizeBytes) assert.EqualValues(t, 1024*1024*10, c.ScanRateBytesPerSec) assert.Len(t, c.ExcludeFiles, 2) - assert.EqualValues(t, `\.DS_Store(?-m:$)`, c.ExcludeFiles[0].String()) - assert.EqualValues(t, `\.swp(?-m:$)`, c.ExcludeFiles[1].String()) + assert.EqualValues(t, `(?-m:\.DS_Store$)`, c.ExcludeFiles[0].String()) + assert.EqualValues(t, `(?-m:\.swp$)`, c.ExcludeFiles[1].String()) assert.Len(t, c.IncludeFiles, 1) - assert.EqualValues(t, `\.ssh/(?-m:$)`, c.IncludeFiles[0].String()) + assert.EqualValues(t, `(?-m:\.ssh/$)`, c.IncludeFiles[0].String()) assert.Len(t, c.FileParsers, 2) } diff --git a/dev-tools/kubernetes/filebeat/Dockerfile.debug b/dev-tools/kubernetes/filebeat/Dockerfile.debug index 42c15c197949..2dd6404b2fe3 100644 --- a/dev-tools/kubernetes/filebeat/Dockerfile.debug +++ b/dev-tools/kubernetes/filebeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.21.12 as builder +FROM golang:1.22.5 as builder ENV PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/go/bin:/usr/local/go/bin diff --git a/dev-tools/kubernetes/heartbeat/Dockerfile.debug b/dev-tools/kubernetes/heartbeat/Dockerfile.debug index ba7858f49fd9..6446464dd594 100644 --- a/dev-tools/kubernetes/heartbeat/Dockerfile.debug +++ b/dev-tools/kubernetes/heartbeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.21.12 as builder +FROM golang:1.22.5 as builder ENV PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/go/bin:/usr/local/go/bin diff --git a/dev-tools/kubernetes/metricbeat/Dockerfile.debug b/dev-tools/kubernetes/metricbeat/Dockerfile.debug index b31cc69b9c2c..4ebf6c932239 100644 --- a/dev-tools/kubernetes/metricbeat/Dockerfile.debug +++ b/dev-tools/kubernetes/metricbeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.21.12 as builder +FROM golang:1.22.5 as builder ENV PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/go/bin:/usr/local/go/bin diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index ddeabbfdb79b..b3cc26bf7e42 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -337,7 +337,7 @@ func (b GolangCrossBuilder) Build() error { // Ensure the proper platform is passed // This fixes an issue where during arm64 linux build for the currently used docker image - // docker.elastic.co/beats-dev/golang-crossbuild:1.21.9-arm the image for amd64 arch is pulled + // docker.elastic.co/beats-dev/golang-crossbuild:1.22.5-arm the image for amd64 arch is pulled // and causes problems when using native arch tools on the binaries that are built for arm64 arch. if strings.HasPrefix(b.Platform, "linux/") { args = append(args, diff --git a/go.mod b/go.mod index d077854f8730..d34dabc16ad4 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/elastic/beats/v7 -go 1.21.0 - -toolchain go1.21.12 +go 1.22.5 require ( cloud.google.com/go/bigquery v1.55.0 diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index ca0116f6e9dd..753825ecc115 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 RUN \ apt-get update \ diff --git a/libbeat/docs/version.asciidoc b/libbeat/docs/version.asciidoc index 0675c083fcf8..8a304e043679 100644 --- a/libbeat/docs/version.asciidoc +++ b/libbeat/docs/version.asciidoc @@ -1,6 +1,6 @@ :stack-version: 8.15.0 :doc-branch: main -:go-version: 1.21.12 +:go-version: 1.22.5 :release-state: unreleased :python: 3.7 :docker: 1.12 diff --git a/libbeat/processors/actions/drop_fields_test.go b/libbeat/processors/actions/drop_fields_test.go index f8a701d5af07..d49e4561fdd9 100644 --- a/libbeat/processors/actions/drop_fields_test.go +++ b/libbeat/processors/actions/drop_fields_test.go @@ -107,7 +107,7 @@ func TestNewDropFields(t *testing.T) { assert.True(t, ok) assert.Equal(t, []string{"third"}, processor.Fields) assert.Equal(t, "", processor.RegexpFields[0].String()) - assert.Equal(t, "field_(?-s:.)*1", processor.RegexpFields[1].String()) + assert.Equal(t, "(?-s:field_.*1)", processor.RegexpFields[1].String()) }) t.Run("returns error when regexp field is badly written", func(t *testing.T) { diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index fe18d06e2401..47d64bacb7f7 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 COPY --from=docker:26.0.0-alpine3.19 /usr/local/bin/docker /usr/local/bin/ RUN \ diff --git a/metricbeat/module/http/_meta/Dockerfile b/metricbeat/module/http/_meta/Dockerfile index 1c5adb9cf5bc..caa7dd400849 100644 --- a/metricbeat/module/http/_meta/Dockerfile +++ b/metricbeat/module/http/_meta/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 COPY test/main.go main.go diff --git a/metricbeat/module/nats/_meta/Dockerfile b/metricbeat/module/nats/_meta/Dockerfile index ea9a8b9ca535..111e733538db 100644 --- a/metricbeat/module/nats/_meta/Dockerfile +++ b/metricbeat/module/nats/_meta/Dockerfile @@ -2,7 +2,7 @@ ARG NATS_VERSION=2.0.4 FROM nats:$NATS_VERSION # build stage -FROM golang:1.21.12 AS build-env +FROM golang:1.22.5 AS build-env RUN apt-get install git mercurial gcc RUN git clone https://github.com/nats-io/nats.go.git /nats-go RUN cd /nats-go/examples/nats-bench && git checkout tags/v1.10.0 && go build . diff --git a/metricbeat/module/vsphere/_meta/Dockerfile b/metricbeat/module/vsphere/_meta/Dockerfile index db1b32f5967f..8fcf83b2ded5 100644 --- a/metricbeat/module/vsphere/_meta/Dockerfile +++ b/metricbeat/module/vsphere/_meta/Dockerfile @@ -1,5 +1,5 @@ ARG VSPHERE_GOLANG_VERSION -FROM golang:1.21.12 +FROM golang:1.22.5 RUN apt-get install curl git RUN go install github.com/vmware/govmomi/vcsim@v0.30.4 diff --git a/packetbeat/Dockerfile b/packetbeat/Dockerfile index 1e9ff2a10e63..46e77bccef77 100644 --- a/packetbeat/Dockerfile +++ b/packetbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 RUN \ apt-get update \ diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile index ab993ab63bca..57f39f1e3ea2 100644 --- a/x-pack/functionbeat/Dockerfile +++ b/x-pack/functionbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.12 +FROM golang:1.22.5 RUN \ apt-get update \ diff --git a/x-pack/metricbeat/module/mssql/_meta/supported-versions.yml b/x-pack/metricbeat/module/mssql/_meta/supported-versions.yml index e9f409a28750..6d68c61adeb5 100644 --- a/x-pack/metricbeat/module/mssql/_meta/supported-versions.yml +++ b/x-pack/metricbeat/module/mssql/_meta/supported-versions.yml @@ -1,2 +1,2 @@ variants: - - MSSQL_VERSION: 2017-GA-ubuntu + - MSSQL_VERSION: 2017-CU31-GDR2-ubuntu-18.04 diff --git a/x-pack/metricbeat/module/mssql/docker-compose.yml b/x-pack/metricbeat/module/mssql/docker-compose.yml index 9fce8257135e..eccea7bda053 100644 --- a/x-pack/metricbeat/module/mssql/docker-compose.yml +++ b/x-pack/metricbeat/module/mssql/docker-compose.yml @@ -2,10 +2,10 @@ version: '2.3' services: mssql: - image: docker.elastic.co/integrations-ci/beats-mssql:${MSSQL_VERSION:-2017-GA-ubuntu}-1 + image: docker.elastic.co/integrations-ci/beats-mssql:${MSSQL_VERSION:-2017-CU31-GDR2-ubuntu-18.04}-1 build: context: ./_meta args: - MSSQL_VERSION: ${MSSQL_VERSION:-2017-GA-ubuntu} + MSSQL_VERSION: ${MSSQL_VERSION:-2017-CU31-GDR2-ubuntu-18.04} ports: - 1433 diff --git a/x-pack/metricbeat/module/stan/_meta/Dockerfile b/x-pack/metricbeat/module/stan/_meta/Dockerfile index 583c2929ebcb..6192a19570ef 100644 --- a/x-pack/metricbeat/module/stan/_meta/Dockerfile +++ b/x-pack/metricbeat/module/stan/_meta/Dockerfile @@ -2,7 +2,7 @@ ARG STAN_VERSION=0.15.1 FROM nats-streaming:$STAN_VERSION # build stage -FROM golang:1.21.12 AS build-env +FROM golang:1.22.5 AS build-env RUN apt-get install git mercurial gcc RUN git clone https://github.com/nats-io/stan.go.git /stan-go RUN cd /stan-go/examples/stan-bench && git checkout tags/v0.5.2 && go build .