From 5cc26c0d898578b545ae81c74db00164f0a7c44b Mon Sep 17 00:00:00 2001 From: Anderson Queiroz Date: Mon, 24 Jul 2023 18:13:17 +0200 Subject: [PATCH] upgrade Go to 1.20.5 --- .go-version | 2 +- .golangci.yml | 9 ++++----- CHANGELOG.next.asciidoc | 1 + auditbeat/Dockerfile | 4 ++-- .../kubernetes/filebeat/Dockerfile.debug | 2 +- .../kubernetes/heartbeat/Dockerfile.debug | 2 +- .../kubernetes/metricbeat/Dockerfile.debug | 2 +- dev-tools/mage/gotest_test.go | 20 +++++++++---------- heartbeat/Dockerfile | 4 ++-- libbeat/docs/version.asciidoc | 2 +- libbeat/reader/syslog/rfc3164_test.go | 2 +- libbeat/reader/syslog/rfc5424_test.go | 2 +- metricbeat/Dockerfile | 4 ++-- metricbeat/module/http/_meta/Dockerfile | 2 +- metricbeat/module/nats/_meta/Dockerfile | 2 +- packetbeat/Dockerfile | 4 ++-- x-pack/functionbeat/Dockerfile | 4 ++-- .../metricbeat/module/stan/_meta/Dockerfile | 2 +- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.go-version b/.go-version index 88ebadf2c32..7bf9455f08c 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.19.10 +1.20.5 diff --git a/.golangci.yml b/.golangci.yml index 793f4a05866..867324d3d99 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -109,7 +109,7 @@ linters-settings: gosimple: # Select the Go version to target. The default is '1.13'. - go: "1.19.10" + go: "1.20.5" nakedret: # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 @@ -127,19 +127,19 @@ linters-settings: staticcheck: # Select the Go version to target. The default is '1.13'. - go: "1.19.10" + go: "1.20.5" checks: ["all"] stylecheck: # Select the Go version to target. The default is '1.13'. - go: "1.19.10" + go: "1.20.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.19.10" + go: "1.20.5" gosec: excludes: @@ -162,4 +162,3 @@ linters-settings: # Report pre-allocation suggestions on for loops. # Default: false for-loops: true - \ No newline at end of file diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 14021299b72..2deaa5fdd94 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -11,6 +11,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] *Affecting all Beats* - Update Go version to 1.19.10 {pull}35751[35751] - Fix status reporting to Elastic-Agent when output configuration is invalid running under Elastic-Agent {pull}35719[35719] +- Upgrade Go to 1.20.5 *Auditbeat* diff --git a/auditbeat/Dockerfile b/auditbeat/Dockerfile index d410055f8d5..41c59fa469d 100644 --- a/auditbeat/Dockerfile +++ b/auditbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 RUN \ apt-get update \ @@ -11,7 +11,7 @@ RUN \ && rm -rf /var/lib/apt/lists/* # Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts -# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +# with the system Python installation. golang:1.20.5 uses Debian 12 which now enforces PEP668. ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/dev-tools/kubernetes/filebeat/Dockerfile.debug b/dev-tools/kubernetes/filebeat/Dockerfile.debug index 96458cbffbe..92b303af600 100644 --- a/dev-tools/kubernetes/filebeat/Dockerfile.debug +++ b/dev-tools/kubernetes/filebeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.19.10 as builder +FROM golang:1.20.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 bacfa95ca35..23ee8b1f71a 100644 --- a/dev-tools/kubernetes/heartbeat/Dockerfile.debug +++ b/dev-tools/kubernetes/heartbeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.19.10 as builder +FROM golang:1.20.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 da68b4fb5d1..601aa7b9f2b 100644 --- a/dev-tools/kubernetes/metricbeat/Dockerfile.debug +++ b/dev-tools/kubernetes/metricbeat/Dockerfile.debug @@ -1,4 +1,4 @@ -FROM golang:1.19.10 as builder +FROM golang:1.20.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/gotest_test.go b/dev-tools/mage/gotest_test.go index edbb1e549f9..49784c0fd6c 100644 --- a/dev-tools/mage/gotest_test.go +++ b/dev-tools/mage/gotest_test.go @@ -210,41 +210,41 @@ var wantTestAssertOutput = `(?sm: Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/assert_fails.* - --- FAIL: TestGoTest_Helper_AssertOutput/assert_fails .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/assert_with_message .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/assert_with_message.* Messages: My message.* - --- FAIL: TestGoTest_Helper_AssertOutput/assert_with_message .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/assert_with_messagef .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/assert_with_messagef.* Messages: My message with arguments: 42.* - --- FAIL: TestGoTest_Helper_AssertOutput/assert_with_messagef .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/require_fails .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/require_fails.* - --- FAIL: TestGoTest_Helper_AssertOutput/require_fails .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/require_with_message .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/require_with_message.* Messages: My message.* - --- FAIL: TestGoTest_Helper_AssertOutput/require_with_message .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/require_with_messagef .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* Error: Should be true.* Test: TestGoTest_Helper_AssertOutput/require_with_messagef.* Messages: My message with arguments: 42.* - --- FAIL: TestGoTest_Helper_AssertOutput/require_with_messagef .* + === FAIL: dev-tools/mage TestGoTest_Helper_AssertOutput/equals_map .* gotest_test.go:\d+:.* Error Trace: gotest_test.go:\d+.* @@ -306,17 +306,17 @@ var wantTestLogOutput = `(?sm: gotest_test.go:\d+: printf style log message: 42.* gotest_test.go:\d+: Log should fail.* gotest_test.go:\d+: Log should fail with printf style log: 23.* - --- FAIL: TestGoTest_Helper_LogOutput/on_error.* + === FAIL: dev-tools/mage TestGoTest_Helper_LogOutput/on_fatal.* gotest_test.go:\d+: Log message should be printed.* gotest_test.go:\d+: printf style log message: 42.* gotest_test.go:\d+: Log should fail.* - --- FAIL: TestGoTest_Helper_LogOutput/on_fatal.* + === FAIL: dev-tools/mage TestGoTest_Helper_LogOutput/on_fatalf.* gotest_test.go:\d+: Log message should be printed.* gotest_test.go:\d+: printf style log message: 42.* gotest_test.go:\d+: Log should fail with printf style log: 42.* - --- FAIL: TestGoTest_Helper_LogOutput/on_fatalf.* + === FAIL: dev-tools/mage TestGoTest_Helper_LogOutput/with_newlines.* gotest_test.go:\d+: Log.* message.* @@ -336,7 +336,7 @@ var wantTestLogOutput = `(?sm: style.* log:.* 42.* - --- FAIL: TestGoTest_Helper_LogOutput/with_newlines.* + === FAIL: dev-tools/mage TestGoTest_Helper_LogOutput.* DONE 5 tests, 5 failures in.* )` diff --git a/heartbeat/Dockerfile b/heartbeat/Dockerfile index 4f063983998..fddae9ad771 100644 --- a/heartbeat/Dockerfile +++ b/heartbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 RUN \ apt-get update \ @@ -10,7 +10,7 @@ RUN \ && rm -rf /var/lib/apt/lists/* # Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts -# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +# with the system Python installation. golang:1.20.5 uses Debian 12 which now enforces PEP668. ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/libbeat/docs/version.asciidoc b/libbeat/docs/version.asciidoc index a73f993a283..ac1a00e6e8b 100644 --- a/libbeat/docs/version.asciidoc +++ b/libbeat/docs/version.asciidoc @@ -1,6 +1,6 @@ :stack-version: 8.9.0 :doc-branch: master -:go-version: 1.19.10 +:go-version: 1.20.5 :release-state: unreleased :python: 3.7 :docker: 1.12 diff --git a/libbeat/reader/syslog/rfc3164_test.go b/libbeat/reader/syslog/rfc3164_test.go index 2f14fd9e22b..d1c75fe574e 100644 --- a/libbeat/reader/syslog/rfc3164_test.go +++ b/libbeat/reader/syslog/rfc3164_test.go @@ -156,7 +156,7 @@ func TestParseRFC3164(t *testing.T) { hostname: "test-host", msg: "this is the message", }, - wantErr: `validation error at position 5: parsing time "24-08-2003T05:14:15-07:00" as "2006-01-02T15:04:05.999999999Z07:00": cannot parse "8-2003T05:14:15-07:00" as "2006"`, + wantErr: `validation error at position 5: parsing time "24-08-2003T05:14:15-07:00" as "2006-01-02T15:04:05.999999999Z07:00": cannot parse "24-08-2003T05:14:15-07:00" as "2006"`, }, "err-eof": { in: "<13>Oct 11 22:14:15 test-", diff --git a/libbeat/reader/syslog/rfc5424_test.go b/libbeat/reader/syslog/rfc5424_test.go index 539278a8c69..47cb9ee0e36 100644 --- a/libbeat/reader/syslog/rfc5424_test.go +++ b/libbeat/reader/syslog/rfc5424_test.go @@ -153,7 +153,7 @@ func TestParseRFC5424(t *testing.T) { msgID: "ID47", rawSDValue: `[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"][examplePriority@32473 class="high"]`, }, - wantErr: `validation error at position 8: parsing time "10-11-2003T22:14:15.003Z" as "2006-01-02T15:04:05.999999999Z07:00": cannot parse "1-2003T22:14:15.003Z" as "2006"`, + wantErr: "validation error at position 8: parsing time \"10-11-2003T22:14:15.003Z\" as \"2006-01-02T15:04:05.999999999Z07:00\": cannot parse \"10-11-2003T22:14:15.003Z\" as \"2006\"", }, "err-eof": { in: `<13>1 2003-08-24T05:14:15.000003-07:00 test-host su 1234 msg-`, diff --git a/metricbeat/Dockerfile b/metricbeat/Dockerfile index 407d9e4fac8..29b2d3d6b09 100644 --- a/metricbeat/Dockerfile +++ b/metricbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 RUN \ apt update \ @@ -13,7 +13,7 @@ RUN \ && rm -rf /var/lib/apt/lists/* # Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts -# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +# with the system Python installation. golang:1.20.5 uses Debian 12 which now enforces PEP668. ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/metricbeat/module/http/_meta/Dockerfile b/metricbeat/module/http/_meta/Dockerfile index 8565b542b1a..0a788a605a9 100644 --- a/metricbeat/module/http/_meta/Dockerfile +++ b/metricbeat/module/http/_meta/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 COPY test/main.go main.go diff --git a/metricbeat/module/nats/_meta/Dockerfile b/metricbeat/module/nats/_meta/Dockerfile index bbc62eaa888..20c7a9ca103 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.19.10 AS build-env +FROM golang:1.20.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/packetbeat/Dockerfile b/packetbeat/Dockerfile index 4d6e1f522e0..ff8c0a4f526 100644 --- a/packetbeat/Dockerfile +++ b/packetbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 RUN \ apt-get update \ @@ -12,7 +12,7 @@ RUN \ && rm -rf /var/lib/apt/lists/* # Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts -# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +# with the system Python installation. golang:1.20.5 uses Debian 12 which now enforces PEP668. ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile index 3d0953e88e1..c9147d376f0 100644 --- a/x-pack/functionbeat/Dockerfile +++ b/x-pack/functionbeat/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.19.10 +FROM golang:1.20.5 RUN \ apt-get update \ @@ -11,7 +11,7 @@ RUN \ && rm -rf /var/lib/apt/lists/* # Use a virtualenv to avoid the PEP668 "externally managed environment" error caused by conflicts -# with the system Python installation. golang:1.19.10 uses Debian 12 which now enforces PEP668. +# with the system Python installation. golang:1.20.5 uses Debian 12 which now enforces PEP668. ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" diff --git a/x-pack/metricbeat/module/stan/_meta/Dockerfile b/x-pack/metricbeat/module/stan/_meta/Dockerfile index db00a41578f..9ce3ca20768 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.19.10 AS build-env +FROM golang:1.20.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 .