From eae9a2a116c23ef0491925982542642639ef34e3 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Mon, 22 Aug 2022 18:19:32 +0000 Subject: [PATCH] Update to Go1.18.5 * builds from https://github.com/DataDog/datadog-agent-buildimages/pull/270 * builds from https://github.com/DataDog/datadog-agent-builders/pull/224 * already using the new macos build image --- .circleci/config.yml | 2 +- .circleci/images/runner/Dockerfile | 2 +- .gitlab-ci.yml | 12 ++++++------ .go-version | 2 +- README.md | 2 +- devenv/scripts/Install-DevEnv.ps1 | 6 +++--- docs/dev/agent_dev_env.md | 2 +- go.mod | 2 +- internal/tools/go.mod | 2 +- internal/tools/independent-lint/go.mod | 2 +- internal/tools/modparser/go.mod | 2 +- internal/tools/modparser/testdata/match/go.mod | 2 +- internal/tools/modparser/testdata/nomatch/go.mod | 2 +- internal/tools/proto/go.mod | 2 +- pkg/dogstatsd/batch.go | 1 + pkg/dogstatsd/parse_events.go | 7 +++---- pkg/otlp/model/go.mod | 2 +- pkg/quantile/go.mod | 2 +- pkg/remoteconfig/state/go.mod | 2 +- pkg/security/secl/go.mod | 2 +- pkg/trace/go.mod | 2 +- releasenotes/notes/go1185-fd9d8b88c7c7a12e.yaml | 11 +++++++++++ test/e2e/containers/otlp_sender/go.mod | 2 +- tools/gdb/Dockerfile | 2 +- tools/retry_file_dump/go.mod | 2 +- 25 files changed, 44 insertions(+), 33 deletions(-) create mode 100644 releasenotes/notes/go1185-fd9d8b88c7c7a12e.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index fb48e4f4877ee..3e2d2a211ede3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ experimental: templates: job_template: &job_template docker: - - image: datadog/datadog-agent-runner-circle:go11711 + - image: datadog/datadog-agent-runner-circle:go1185 environment: USE_SYSTEM_LIBS: "1" working_directory: /go/src/github.com/DataDog/datadog-agent diff --git a/.circleci/images/runner/Dockerfile b/.circleci/images/runner/Dockerfile index ad60a70f929d5..b6b9dfbd0ed72 100644 --- a/.circleci/images/runner/Dockerfile +++ b/.circleci/images/runner/Dockerfile @@ -29,7 +29,7 @@ RUN set -ex \ ssh # Golang -ENV GIMME_GO_VERSION 1.17.11 +ENV GIMME_GO_VERSION 1.18.5 ENV GOROOT /root/.gimme/versions/go$GIMME_GO_VERSION.linux.amd64 ENV GOPATH /go ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 18f4ee0e693a2..e498252994fd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,12 +139,12 @@ variables: S3_DSD6_URI: s3://dsd6-staging RELEASE_VERSION_6: nightly RELEASE_VERSION_7: nightly-a7 - DATADOG_AGENT_BUILDIMAGES: v9405677-746a71d - DATADOG_AGENT_BUILDERS: v8333476-cd1c34b - DATADOG_AGENT_WINBUILDIMAGES: v9405677-746a71d - DATADOG_AGENT_ARMBUILDIMAGES: v9405677-746a71d - DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v8364396-f91ff4f - DATADOG_AGENT_NIKOS_BUILDIMAGES: v8364396-f91ff4f + DATADOG_AGENT_BUILDIMAGES: v9472974-a8f8b46 + DATADOG_AGENT_BUILDERS: v9531714-74df2d8 + DATADOG_AGENT_WINBUILDIMAGES: v9472974-a8f8b46 + DATADOG_AGENT_ARMBUILDIMAGES: v9472974-a8f8b46 + DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v9472974-a8f8b46 + DATADOG_AGENT_NIKOS_BUILDIMAGES: v9472974-a8f8b46 DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded DOCKER_X64_BUILDER: v2718644-9ce6565-18.09.6-py3 NIKOS_INSTALL_DIR: /opt/datadog-agent/embedded/nikos diff --git a/.go-version b/.go-version index 487e9b068686d..8e8b0a9335a8d 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.17.11 \ No newline at end of file +1.18.5 diff --git a/README.md b/README.md index 9bd33c56bc970..5072fe957e93f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ and development, is located under [the docs directory](docs) of the present repo ## Getting started To build the Agent you need: - * [Go](https://golang.org/doc/install) 1.17 or later. You'll also need to set your `$GOPATH` and have `$GOPATH/bin` in your path. + * [Go](https://golang.org/doc/install) 1.18 or later. You'll also need to set your `$GOPATH` and have `$GOPATH/bin` in your path. * Python 3.7+ along with development libraries for tooling. You will also need Python 2.7 if you are building the Agent with Python 2 support. * Python dependencies. You may install these with `pip install -r requirements.txt` This will also pull in [Invoke](http://www.pyinvoke.org) if not yet installed. diff --git a/devenv/scripts/Install-DevEnv.ps1 b/devenv/scripts/Install-DevEnv.ps1 index cf9232350b4a5..809d8e4c61f57 100644 --- a/devenv/scripts/Install-DevEnv.ps1 +++ b/devenv/scripts/Install-DevEnv.ps1 @@ -45,11 +45,11 @@ Write-Host -ForegroundColor Yellow -BackgroundColor DarkGreen '- Installing Gola $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' -Write-Host -ForegroundColor Green "Installing go 1.17.11" +Write-Host -ForegroundColor Green "Installing go 1.18.5" -$gozip = "https://dl.google.com/go/go1.17.11.windows-amd64.zip" +$gozip = "https://dl.google.com/go/go1.18.5.windows-amd64.zip" if ($Env:TARGET_ARCH -eq "x86") { - $gozip = "https://dl.google.com/go/go1.17.11.windows-386.zip" + $gozip = "https://dl.google.com/go/go1.18.5.windows-386.zip" } $out = 'c:\go.zip' diff --git a/docs/dev/agent_dev_env.md b/docs/dev/agent_dev_env.md index 6a635e4a43ee1..dc3051c8cb4f5 100644 --- a/docs/dev/agent_dev_env.md +++ b/docs/dev/agent_dev_env.md @@ -93,7 +93,7 @@ variables (see Invoke docs for more details). ## Golang -You must [install Golang](https://golang.org/doc/install) version `1.17.11` or +You must [install Golang](https://golang.org/doc/install) version `1.18.5` or higher. Make sure that `$GOPATH/bin` is in your `$PATH` otherwise `invoke` cannot use any additional tool it might need. diff --git a/go.mod b/go.mod index aa282d785c1a8..db16e7a46c4d1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent -go 1.17 +go 1.18 // v0.8.0 was tagged long ago, and appared on pkg.go.dev. We do not want any tagged version // to appear there. The trick to accomplish this is to make a new version (in this case v0.9.0) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index fccd2c42907e4..76a56f2f4554a 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/internal/tools -go 1.17 +go 1.18 require ( github.com/frapposelli/wwhrd v0.4.0 diff --git a/internal/tools/independent-lint/go.mod b/internal/tools/independent-lint/go.mod index 44ee4730c7f75..c57ec8b188873 100644 --- a/internal/tools/independent-lint/go.mod +++ b/internal/tools/independent-lint/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/cmd/independent-lint -go 1.17 +go 1.18 require golang.org/x/mod v0.5.1 diff --git a/internal/tools/modparser/go.mod b/internal/tools/modparser/go.mod index 18205e0b9a678..77d71e94b129d 100644 --- a/internal/tools/modparser/go.mod +++ b/internal/tools/modparser/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/internal/tools/modparser -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.0 diff --git a/internal/tools/modparser/testdata/match/go.mod b/internal/tools/modparser/testdata/match/go.mod index 274ec75cf2069..f6495967c0bca 100644 --- a/internal/tools/modparser/testdata/match/go.mod +++ b/internal/tools/modparser/testdata/match/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/internal/tools/modparser/testdata/match -go 1.17 +go 1.18 require ( github.com/DataDog/datadog-agent/pkg/test v0.65.3 diff --git a/internal/tools/modparser/testdata/nomatch/go.mod b/internal/tools/modparser/testdata/nomatch/go.mod index b38305b623793..b61b339c37d60 100644 --- a/internal/tools/modparser/testdata/nomatch/go.mod +++ b/internal/tools/modparser/testdata/nomatch/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/internal/tools/modparser/testdata/nomatch -go 1.17 +go 1.18 require ( github.com/DataDog/datadog-not-agent/pkg/test v0.65.3 diff --git a/internal/tools/proto/go.mod b/internal/tools/proto/go.mod index eb9335e53163a..d8741c8613720 100644 --- a/internal/tools/proto/go.mod +++ b/internal/tools/proto/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/internal/tools/proto -go 1.17 +go 1.18 require ( github.com/golang/mock v1.5.0 diff --git a/pkg/dogstatsd/batch.go b/pkg/dogstatsd/batch.go index e4a2490bd2991..29f2fa17afe4c 100644 --- a/pkg/dogstatsd/batch.go +++ b/pkg/dogstatsd/batch.go @@ -3,6 +3,7 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2016-present Datadog, Inc. +// Package dogstatsd implements DogStatsD. package dogstatsd import ( diff --git a/pkg/dogstatsd/parse_events.go b/pkg/dogstatsd/parse_events.go index 99408cee86683..84ebfa88e9caa 100644 --- a/pkg/dogstatsd/parse_events.go +++ b/pkg/dogstatsd/parse_events.go @@ -8,6 +8,7 @@ package dogstatsd import ( "bytes" "fmt" + "math" "github.com/DataDog/datadog-agent/pkg/util/log" ) @@ -92,9 +93,7 @@ func parseHeader(rawHeader []byte) (eventHeader, error) { // Convert title length to workable type and do a basic validity check on value titleLength, err := parseInt64(rawTitleLength) - // Before Go 1.17, we can use the following trick to define MaxInt - const MaxInt = ^uint(0) >> 1 - if err != nil || titleLength < 0 || titleLength > int64(MaxInt) { + if err != nil || titleLength < 0 || titleLength > int64(math.MaxInt) { return eventHeader{}, fmt.Errorf("invalid event header: %q", rawHeader) } @@ -105,7 +104,7 @@ func parseHeader(rawHeader []byte) (eventHeader, error) { // Convert text length to workable type and do a basic validity check on value textLength, err := parseInt64(rawTextLength) - if err != nil || textLength < 0 || textLength > int64(MaxInt) { + if err != nil || textLength < 0 || textLength > int64(math.MaxInt) { return eventHeader{}, fmt.Errorf("invalid event header: %q", rawHeader) } diff --git a/pkg/otlp/model/go.mod b/pkg/otlp/model/go.mod index 1f4948997d0e8..3ab1f2579fed4 100644 --- a/pkg/otlp/model/go.mod +++ b/pkg/otlp/model/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/pkg/otlp/model -go 1.17 +go 1.18 replace github.com/DataDog/datadog-agent/pkg/quantile => ../../quantile diff --git a/pkg/quantile/go.mod b/pkg/quantile/go.mod index 5d73a82e5269a..730afe8ff7b58 100644 --- a/pkg/quantile/go.mod +++ b/pkg/quantile/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/pkg/quantile -go 1.17 +go 1.18 require ( github.com/DataDog/sketches-go v1.4.1 diff --git a/pkg/remoteconfig/state/go.mod b/pkg/remoteconfig/state/go.mod index e6a5259b74fca..9409610c80b9c 100644 --- a/pkg/remoteconfig/state/go.mod +++ b/pkg/remoteconfig/state/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/pkg/remoteconfig/state -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 diff --git a/pkg/security/secl/go.mod b/pkg/security/secl/go.mod index 126e3e7009b0d..e5bd4b4c55731 100644 --- a/pkg/security/secl/go.mod +++ b/pkg/security/secl/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/pkg/security/secl -go 1.17 +go 1.18 require ( github.com/Masterminds/semver v1.5.0 diff --git a/pkg/trace/go.mod b/pkg/trace/go.mod index e04dceed78a69..e4b01e5dbb6f1 100644 --- a/pkg/trace/go.mod +++ b/pkg/trace/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/pkg/trace -go 1.17 +go 1.18 // NOTE: Prefer using simple `require` directives instead of using `replace` if possible. // See https://github.com/DataDog/datadog-agent/blob/main/docs/dev/gomodreplace.md diff --git a/releasenotes/notes/go1185-fd9d8b88c7c7a12e.yaml b/releasenotes/notes/go1185-fd9d8b88c7c7a12e.yaml new file mode 100644 index 0000000000000..9420145533584 --- /dev/null +++ b/releasenotes/notes/go1185-fd9d8b88c7c7a12e.yaml @@ -0,0 +1,11 @@ +# Each section from every release note are combined when the +# CHANGELOG.rst is rendered. So the text needs to be worded so that +# it does not depend on any information only available in another +# section. This may mean repeating some details, but each section +# must be readable independently of the other. +# +# Each section note must be formatted as reStructuredText. +--- +enhancements: + - | + Agents are now built with Go 1.18.5. diff --git a/test/e2e/containers/otlp_sender/go.mod b/test/e2e/containers/otlp_sender/go.mod index ec4d711b21af8..8e7ed14d2b032 100644 --- a/test/e2e/containers/otlp_sender/go.mod +++ b/test/e2e/containers/otlp_sender/go.mod @@ -1,6 +1,6 @@ module github.com/DataDog/datadog-agent/tests/e2e/containers/otlp_sender -go 1.17 +go 1.18 require ( go.opentelemetry.io/collector v0.51.0 diff --git a/tools/gdb/Dockerfile b/tools/gdb/Dockerfile index 4ff4644b3876e..f788333672b8f 100644 --- a/tools/gdb/Dockerfile +++ b/tools/gdb/Dockerfile @@ -6,7 +6,7 @@ RUN rm -vf /etc/ssl/openssl.cnf RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y gdb build-essential strace less vim # Install go -RUN curl -fSL -o golang.tgz https://go.dev/dl/go1.17.11.linux-amd64.tar.gz +RUN curl -fSL -o golang.tgz https://go.dev/dl/go1.18.5.linux-amd64.tar.gz RUN tar xzvf golang.tgz RUN ln -s /go /goroot diff --git a/tools/retry_file_dump/go.mod b/tools/retry_file_dump/go.mod index c8a7de74c269d..478d755f792d4 100644 --- a/tools/retry_file_dump/go.mod +++ b/tools/retry_file_dump/go.mod @@ -5,7 +5,7 @@ module github.com/DataDog/datadog-agent/tools/retry_file_dump -go 1.17 +go 1.18 require github.com/golang/protobuf v1.4.3