Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.17](backport #40082) Update to Go 1.22.5 #40322

Merged
merged 12 commits into from
Jul 29, 2024
Merged
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.12
1.22.5
10 changes: 4 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ linters:
- unused # checks Go code for unused constants, variables, functions and types
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # detects when assignments to existing variables are not used
- structcheck # finds unused struct fields
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- varcheck # Finds unused global variables and constants
- asciicheck # simple linter to check that your code does not contain non-ASCII identifiers
- bodyclose # checks whether HTTP response body is closed successfully
- durationcheck # check for two durations multiplied together
Expand Down Expand Up @@ -102,7 +100,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
Expand All @@ -120,19 +118,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:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Affecting all Beats*

- Update Go version to 1.22.5. {pull}40082[40082]
Fix CVE-2023-25173 by updating github.com/containerd/containerd to v1.5.18 {pull}40096[40096]
- Update github.com/containerd/containerd version to v1.5.18 {pull}40096[40096]

*Auditbeat*
Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7229,11 +7229,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-libaudit/v2@

--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-licenser
Version: v0.4.0
Version: v0.4.2
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].2/LICENSE:


Apache License
Expand Down
2 changes: 1 addition & 1 deletion auditbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
6 changes: 3 additions & 3 deletions auditbeat/module/file_integrity/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
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())
}

func TestConfigInvalid(t *testing.T) {
Expand All @@ -77,12 +77,12 @@

t.Log(err)

ucfgErr, ok := err.(ucfg.Error)

Check failure on line 80 in auditbeat/module/file_integrity/config_test.go

View workflow job for this annotation

GitHub Actions / lint (linux)

type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
if !ok {
t.Fatal("expected ucfg.Error")
}

merr, ok := ucfgErr.Reason().(*multierror.MultiError)

Check failure on line 85 in auditbeat/module/file_integrity/config_test.go

View workflow job for this annotation

GitHub Actions / lint (linux)

type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
if !ok {
t.Fatal("expected MultiError")
}
Expand All @@ -105,7 +105,7 @@

t.Log(err)

ucfgErr, ok = err.(ucfg.Error)

Check failure on line 108 in auditbeat/module/file_integrity/config_test.go

View workflow job for this annotation

GitHub Actions / lint (linux)

type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
if !ok {
t.Fatal("expected ucfg.Error")
}
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/kubernetes/filebeat/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion dev-tools/kubernetes/heartbeat/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion dev-tools/kubernetes/metricbeat/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion filebeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/elastic/beats/v7

go 1.21
go 1.22.5

require (
cloud.google.com/go/bigquery v1.52.0
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/elastic/elastic-agent-client/v7 v7.8.1
github.com/elastic/go-concert v0.2.0
github.com/elastic/go-libaudit/v2 v2.3.1
github.com/elastic/go-licenser v0.4.0
github.com/elastic/go-licenser v0.4.2
github.com/elastic/go-lookslike v0.3.0
github.com/elastic/go-lumber v0.1.0
github.com/elastic/go-perf v0.0.0-20191212140718-9c656876f595
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ github.com/elastic/go-concert v0.2.0 h1:GAQrhRVXprnNjtvTP9pWJ1d4ToEA4cU5ci7TwTa2
github.com/elastic/go-concert v0.2.0/go.mod h1:HWjpO3IAEJUxOeaJOWXWEp7imKd27foxz9V5vegC/38=
github.com/elastic/go-libaudit/v2 v2.3.1 h1:BCPhB3BZTl2YBPJy3XHIu4DFfbbbWEmLMLlK/aJ7U/0=
github.com/elastic/go-libaudit/v2 v2.3.1/go.mod h1:+ZE0czqmbqtnRkl0fNgpI+HvVVRo/ZMJdcXv/PaKcOo=
github.com/elastic/go-licenser v0.4.0 h1:jLq6A5SilDS/Iz1ABRkO6BHy91B9jBora8FwGRsDqUI=
github.com/elastic/go-licenser v0.4.0/go.mod h1:V56wHMpmdURfibNBggaSBfqgPxyT1Tldns1i87iTEvU=
github.com/elastic/go-licenser v0.4.2 h1:bPbGm8bUd8rxzSswFOqvQh1dAkKGkgAmrPxbUi+Y9+A=
github.com/elastic/go-licenser v0.4.2/go.mod h1:W8eH6FaZDR8fQGm+7FnVa7MxI1b/6dAqxz+zPB8nm5c=
github.com/elastic/go-lookslike v0.3.0 h1:HDI/DQ65V85ZqM7D/sbxcK2wFFnh3+7iFvBk2v2FTHs=
github.com/elastic/go-lookslike v0.3.0/go.mod h1:AhH+rdJux5RlVjs+6ej4jkvYyoNRkj2crxmqeHlj3hA=
github.com/elastic/go-lumber v0.1.0 h1:HUjpyg36v2HoKtXlEC53EJ3zDFiDRn65d7B8dBHNius=
Expand Down Expand Up @@ -901,7 +901,6 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/gopher-lua v0.0.0-20170403160031-b402f3114ec7 h1:0gYLpmzecnaDCoeWxSfEJ7J1b6B/67+NV++4HKQXx+Y=
github.com/yuin/gopher-lua v0.0.0-20170403160031-b402f3114ec7/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
Expand Down Expand Up @@ -1000,7 +999,6 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
Expand Down Expand Up @@ -1035,7 +1033,6 @@ golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
Expand Down Expand Up @@ -1114,9 +1111,7 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211102192858-4dd72447c267/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -1188,7 +1183,6 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
Expand Down
2 changes: 1 addition & 1 deletion heartbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion libbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion libbeat/docs/version.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:stack-version: 7.17.22
:doc-branch: 7.17
:go-version: 1.21.12
:go-version: 1.22.5
:release-state: unreleased
:python: 3.7
:docker: 1.12
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1.21.12
COPY --from=docker:26.0.0-alpine3.19 /usr/local/bin/docker /usr/local/bin/
FROM golang:1.22.5
COPY --from=docker:26.0.0-alpine3.19 /usr/local/bin/docker /usr/local/bin/

RUN \
apt update \
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/http/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

COPY test/main.go main.go

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/nats/_meta/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/vsphere/_meta/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packetbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
10 changes: 5 additions & 5 deletions x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ func (Dev) Package() {

// InstallGoLicenser install go-licenser to check license of the files.
func (Prepare) InstallGoLicenser() error {
return GoGet(goLicenserRepo)
return GoInstall(goLicenserRepo)
}

// InstallGoLint for the code.
func (Prepare) InstallGoLint() error {
return GoGet(goLintRepo)
return GoInstall(goLintRepo)
}

// All build all the things for the current projects.
Expand Down Expand Up @@ -424,9 +424,9 @@ func RunGo(args ...string) error {
return sh.RunV(mg.GoCmd(), args...)
}

// GoGet fetch a remote dependencies.
func GoGet(link string) error {
_, err := sh.Exec(map[string]string{"GO111MODULE": "off"}, os.Stdout, os.Stderr, "go", "get", link)
// GoInstall installs a tool by calling `go install <link>
func GoInstall(link string) error {
_, err := sh.Exec(map[string]string{}, os.Stdout, os.Stderr, "go", "install", link)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion x-pack/functionbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
2 changes: 1 addition & 1 deletion x-pack/libbeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.12
FROM golang:1.22.5

RUN \
apt-get update \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
variants:
- MSSQL_VERSION: 2017-GA-ubuntu
- MSSQL_VERSION: 2017-CU31-GDR2-ubuntu-18.04
4 changes: 2 additions & 2 deletions x-pack/metricbeat/module/mssql/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/stan/_meta/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
Loading