Skip to content

Commit

Permalink
chore: Update to go1.21.0 (influxdata#13794)
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj authored Aug 28, 2023
1 parent 318a4b6 commit 5fb290f
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ executors:
working_directory: '/go/src/github.com/influxdata/telegraf'
resource_class: large
docker:
- image: 'quay.io/influxdb/telegraf-ci:1.20.7'
- image: 'quay.io/influxdb/telegraf-ci:1.21.0'
environment:
GOFLAGS: -p=4
mac:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Scan for Vulnerabilities in Code
uses: golang/govulncheck-action@v1
with:
go-version-input: 1.20.7
go-version-input: 1.21.0
go-package: ./...
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl

.PHONY: ci
ci:
docker build -t quay.io/influxdb/telegraf-ci:1.20.7 - < scripts/ci.docker
docker push quay.io/influxdb/telegraf-ci:1.20.7
docker build -t quay.io/influxdb/telegraf-ci:1.21.0 - < scripts/ci.docker
docker push quay.io/influxdb/telegraf-ci:1.21.0

.PHONY: install
install: $(buildbin)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sudo yum install telegraf

### Build From Source

Telegraf requires Go version 1.20 or newer and the Makefile requires GNU make.
Telegraf requires Go version 1.21 or newer and the Makefile requires GNU make.

On Windows, the makefile requires the use of a bash terminal to support all makefile targets.
An easy option to get bash for windows is using the version that comes with [git for windows](https://gitforwindows.org/).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/influxdata/telegraf

go 1.20
go 1.21

require (
cloud.google.com/go/bigquery v1.52.0
Expand Down
45 changes: 45 additions & 0 deletions go.sum

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions plugins/inputs/nvidia_smi/nvidia_smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ func TestGatherValidXML(t *testing.T) {
"clocks_current_sm": 1275,
"clocks_current_video": 1275,
"cuda_version": "12.2",
"current_ecc": "Enabled",
"display_active": "Disabled",
"display_mode": "Enabled",
"driver_version": "535.54.03",
"encoder_stats_average_fps": 0,
"encoder_stats_average_latency": 0,
Expand All @@ -327,7 +330,9 @@ func TestGatherValidXML(t *testing.T) {
"memory_reserved": 869,
"pcie_link_gen_current": 4,
"pcie_link_width_current": 16,
"serial": "1650522003820",
"temperature_gpu": 27,
"vbios_version": "92.00.36.00.02",
},
time.Unix(1689872450, 0)),
testutil.MustMetric(
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci.docker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.7
FROM golang:1.21.0

RUN chmod -R 755 "$GOPATH"

Expand Down
4 changes: 2 additions & 2 deletions scripts/installgo_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -eux

GO_VERSION="1.20.7"
GO_VERSION="1.21.0"
GO_ARCH="linux-amd64"
# from https://golang.org/dl
GO_VERSION_SHA="f0a87f1bcae91c4b69f8dc2bc6d7e6bfcd7524fceec130af525058c0c17b1b44"
GO_VERSION_SHA="d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742"

# Download Go and verify Go tarball
setup_go () {
Expand Down
6 changes: 3 additions & 3 deletions scripts/installgo_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -eux

ARCH=$(uname -m)
GO_VERSION="1.20.7"
GO_VERSION_SHA_arm64="eea1e7e4c2f75c72629050e6a6c7c46c446d64056732a7787fb3ba16ace1982e" # from https://golang.org/dl
GO_VERSION_SHA_amd64="785170eab380a8985d53896808b0a71336d0ea60e0a26099b4ccec77798b1cf4" # from https://golang.org/dl
GO_VERSION="1.21.0"
GO_VERSION_SHA_arm64="3aca44de55c5e098de2f406e98aba328898b05d509a2e2a356416faacf2c4566" # from https://golang.org/dl
GO_VERSION_SHA_amd64="b314de9f704ab122c077d2ec8e67e3670affe8865479d1f01991e7ac55d65e70" # from https://golang.org/dl

if [ "$ARCH" = 'arm64' ]; then
GO_ARCH="darwin-arm64"
Expand Down
2 changes: 1 addition & 1 deletion scripts/installgo_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eux

GO_VERSION="1.20.7"
GO_VERSION="1.21.0"

setup_go () {
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
Expand Down
28 changes: 10 additions & 18 deletions tools/update_goversion/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ func (f FileInfo) Update() error {
return nil
}

// removeZeroPatch cleans version in case the user provides the minor version as "1.19.0" but require "1.19"
func removeZeroPatch(version string) string {
if strings.HasSuffix(version, ".0") {
return strings.Trim(version, ".0")
}
return version
}

// removePatch cleans version from "1.20.1" to "1.20" (think go.mod entry)
func removePatch(version string) string {
verInfo := semver.New(version)
Expand All @@ -53,8 +45,6 @@ func removePatch(version string) string {

// findHash will search the downloads table for the hashes matching the artifacts list
func findHashes(body io.Reader, version string) (map[string]string, error) {
version = removeZeroPatch(version)

htmlTokens := html.NewTokenizer(body)
artifacts := []string{
fmt.Sprintf("go%s.linux-amd64.tar.gz", version),
Expand Down Expand Up @@ -147,8 +137,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
for file, hash := range hashes {
fmt.Printf("%s %s\n", hash, file)
}

zeroPatchVersion := removeZeroPatch(version)
noPatchVersion := removePatch(version)

files := []FileInfo{
Expand Down Expand Up @@ -180,37 +172,37 @@ func main() {
{
FileName: "scripts/ci.docker",
Regex: `(FROM golang):(\d.\d*.\d)`,
Replace: fmt.Sprintf("$1:%s", zeroPatchVersion),
Replace: fmt.Sprintf("$1:%s", version),
},
{
FileName: "scripts/installgo_linux.sh",
Regex: `(GO_VERSION)=("\d.\d*.\d")`,
Replace: fmt.Sprintf("$1=%q", zeroPatchVersion),
Replace: fmt.Sprintf("$1=%q", version),
},
{
FileName: "scripts/installgo_mac.sh",
Regex: `(GO_VERSION)=("\d.\d*.\d")`,
Replace: fmt.Sprintf("$1=%q", zeroPatchVersion),
Replace: fmt.Sprintf("$1=%q", version),
},
{
FileName: "scripts/installgo_windows.sh",
Regex: `(GO_VERSION)=("\d.\d*.\d")`,
Replace: fmt.Sprintf("$1=%q", zeroPatchVersion),
Replace: fmt.Sprintf("$1=%q", version),
},
{
FileName: "scripts/installgo_linux.sh",
Regex: `(GO_VERSION_SHA)=".*"`,
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.linux-amd64.tar.gz", zeroPatchVersion)]),
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.linux-amd64.tar.gz", version)]),
},
{
FileName: "scripts/installgo_mac.sh",
Regex: `(GO_VERSION_SHA_arm64)=".*"`,
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.darwin-arm64.tar.gz", zeroPatchVersion)]),
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.darwin-arm64.tar.gz", version)]),
},
{
FileName: "scripts/installgo_mac.sh",
Regex: `(GO_VERSION_SHA_amd64)=".*"`,
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.darwin-amd64.tar.gz", zeroPatchVersion)]),
Replace: fmt.Sprintf("$1=%q", hashes[fmt.Sprintf("go%s.darwin-amd64.tar.gz", version)]),
},
}

Expand Down
15 changes: 3 additions & 12 deletions tools/update_goversion/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,13 @@ func TestFindHash(t *testing.T) {
"go1.19.2.darwin-amd64.tar.gz": "16f8047d7b627699b3773680098fbaf7cc962b7db02b3e02726f78c4db26dfde",
},
},
{
"testdata/godev_minor.html",
"1.19",
map[string]string{
"go1.19.linux-amd64.tar.gz": "464b6b66591f6cf055bc5df90a9750bf5fbc9d038722bb84a9d56a2bea974be6",
"go1.19.darwin-arm64.tar.gz": "859e0a54b7fcea89d9dd1ec52aab415ac8f169999e5fdfb0f0c15b577c4ead5e",
"go1.19.darwin-amd64.tar.gz": "df6509885f65f0d7a4eaf3dfbe7dda327569787e8a0a31cbf99ae3a6e23e9ea8",
},
},
{
"testdata/godev_minor.html",
"1.19.0",
map[string]string{
"go1.19.linux-amd64.tar.gz": "464b6b66591f6cf055bc5df90a9750bf5fbc9d038722bb84a9d56a2bea974be6",
"go1.19.darwin-arm64.tar.gz": "859e0a54b7fcea89d9dd1ec52aab415ac8f169999e5fdfb0f0c15b577c4ead5e",
"go1.19.darwin-amd64.tar.gz": "df6509885f65f0d7a4eaf3dfbe7dda327569787e8a0a31cbf99ae3a6e23e9ea8",
"go1.19.0.linux-amd64.tar.gz": "464b6b66591f6cf055bc5df90a9750bf5fbc9d038722bb84a9d56a2bea974be6",
"go1.19.0.darwin-arm64.tar.gz": "859e0a54b7fcea89d9dd1ec52aab415ac8f169999e5fdfb0f0c15b577c4ead5e",
"go1.19.0.darwin-amd64.tar.gz": "df6509885f65f0d7a4eaf3dfbe7dda327569787e8a0a31cbf99ae3a6e23e9ea8",
},
},
}
Expand Down
38 changes: 19 additions & 19 deletions tools/update_goversion/testdata/godev_minor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.src.tar.gz">go1.19.src.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.src.tar.gz">go1.19.0.src.tar.gz</a></td>
<td>Source</td>
<td></td>
<td></td>
Expand All @@ -23,7 +23,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.darwin-amd64.tar.gz">go1.19.darwin-amd64.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.darwin-amd64.tar.gz">go1.19.0.darwin-amd64.tar.gz</a></td>
<td>Archive</td>
<td>macOS</td>
<td>x86-64</td>
Expand All @@ -32,7 +32,7 @@
</tr>

<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.darwin-amd64.pkg">go1.19.darwin-amd64.pkg</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.darwin-amd64.pkg">go1.19.0.darwin-amd64.pkg</a></td>
<td>Installer</td>
<td>macOS</td>
<td>x86-64</td>
Expand All @@ -41,7 +41,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.darwin-arm64.tar.gz">go1.19.darwin-arm64.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.darwin-arm64.tar.gz">go1.19.0.darwin-arm64.tar.gz</a></td>
<td>Archive</td>
<td>macOS</td>
<td>ARM64</td>
Expand All @@ -50,7 +50,7 @@
</tr>

<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.darwin-arm64.pkg">go1.19.darwin-arm64.pkg</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.darwin-arm64.pkg">go1.19.0.darwin-arm64.pkg</a></td>
<td>Installer</td>
<td>macOS</td>
<td>ARM64</td>
Expand All @@ -59,7 +59,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-386.tar.gz">go1.19.linux-386.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-386.tar.gz">go1.19.0.linux-386.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>x86</td>
Expand All @@ -68,7 +68,7 @@
</tr>

<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-amd64.tar.gz">go1.19.linux-amd64.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-amd64.tar.gz">go1.19.0.linux-amd64.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>x86-64</td>
Expand All @@ -77,7 +77,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-arm64.tar.gz">go1.19.linux-arm64.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-arm64.tar.gz">go1.19.0.linux-arm64.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>ARM64</td>
Expand All @@ -86,7 +86,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-armv6l.tar.gz">go1.19.linux-armv6l.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-armv6l.tar.gz">go1.19.0.linux-armv6l.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>ARMv6</td>
Expand All @@ -95,7 +95,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-386.zip">go1.19.windows-386.zip</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-386.zip">go1.19.0.windows-386.zip</a></td>
<td>Archive</td>
<td>Windows</td>
<td>x86</td>
Expand All @@ -104,7 +104,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-386.msi">go1.19.windows-386.msi</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-386.msi">go1.19.0.windows-386.msi</a></td>
<td>Installer</td>
<td>Windows</td>
<td>x86</td>
Expand All @@ -113,7 +113,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-amd64.zip">go1.19.windows-amd64.zip</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-amd64.zip">go1.19.0.windows-amd64.zip</a></td>
<td>Archive</td>
<td>Windows</td>
<td>x86-64</td>
Expand All @@ -122,7 +122,7 @@
</tr>

<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-amd64.msi">go1.19.windows-amd64.msi</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-amd64.msi">go1.19.0.windows-amd64.msi</a></td>
<td>Installer</td>
<td>Windows</td>
<td>x86-64</td>
Expand All @@ -135,7 +135,7 @@
<tr class="first"><th colspan="6" class="first">Other Ports</th></tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.freebsd-386.tar.gz">go1.19.freebsd-386.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.freebsd-386.tar.gz">go1.19.0.freebsd-386.tar.gz</a></td>
<td>Archive</td>
<td>FreeBSD</td>
<td>x86</td>
Expand All @@ -144,7 +144,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.freebsd-amd64.tar.gz">go1.19.freebsd-amd64.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.freebsd-amd64.tar.gz">go1.19.0.freebsd-amd64.tar.gz</a></td>
<td>Archive</td>
<td>FreeBSD</td>
<td>x86-64</td>
Expand All @@ -153,7 +153,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-ppc64le.tar.gz">go1.19.linux-ppc64le.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-ppc64le.tar.gz">go1.19.0.linux-ppc64le.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>ppc64le</td>
Expand All @@ -162,7 +162,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.linux-s390x.tar.gz">go1.19.linux-s390x.tar.gz</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.linux-s390x.tar.gz">go1.19.0.linux-s390x.tar.gz</a></td>
<td>Archive</td>
<td>Linux</td>
<td>s390x</td>
Expand All @@ -171,7 +171,7 @@
</tr>

<tr>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-arm64.zip">go1.19.windows-arm64.zip</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-arm64.zip">go1.19.0.windows-arm64.zip</a></td>
<td>Archive</td>
<td>Windows</td>
<td>ARM64</td>
Expand All @@ -180,7 +180,7 @@
</tr>

<tr class="highlight">
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.windows-arm64.msi">go1.19.windows-arm64.msi</a></td>
<td class="filename"><a class="download" href="/web/20220802171248/https://go.dev/dl/go1.19.0.windows-arm64.msi">go1.19.0.windows-arm64.msi</a></td>
<td>Installer</td>
<td>Windows</td>
<td>ARM64</td>
Expand Down

0 comments on commit 5fb290f

Please sign in to comment.