chore: Update to go1.20.1 (#12679)
This commit is contained in:
parent
0244614b71
commit
9c79277405
|
|
@ -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'
|
||||
- image: 'quay.io/influxdb/telegraf-ci:1.20.1'
|
||||
environment:
|
||||
GOFLAGS: -p=4
|
||||
mac:
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -241,8 +241,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 - < scripts/ci.docker
|
||||
docker push quay.io/influxdb/telegraf-ci:1.20
|
||||
docker build -t quay.io/influxdb/telegraf-ci:1.20.1 - < scripts/ci.docker
|
||||
docker push quay.io/influxdb/telegraf-ci:1.20.1
|
||||
|
||||
.PHONY: install
|
||||
install: $(buildbin)
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -1,6 +1,6 @@
|
|||
module github.com/influxdata/telegraf
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
cloud.google.com/go/bigquery v1.45.0
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ func TestParseTimestampInvalid(t *testing.T) {
|
|||
name: "layout not matching time",
|
||||
format: "rfc3339",
|
||||
timestamp: "09.07.2019 00:11:00",
|
||||
expected: "cannot parse \"09.07.2019 00:11:00\" as \"2006\"",
|
||||
expected: "parsing time \"09.07.2019 00:11:00\" as \"2006-01-02T15:04:05Z07:00\": cannot parse",
|
||||
},
|
||||
{
|
||||
name: "unix wrong type",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
FROM golang:1.20
|
||||
FROM golang:1.20.1
|
||||
|
||||
RUN chmod -R 755 "$GOPATH"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
set -eux
|
||||
|
||||
GO_VERSION="1.20"
|
||||
GO_VERSION="1.20.1"
|
||||
GO_ARCH="linux-amd64"
|
||||
# from https://golang.org/dl
|
||||
GO_VERSION_SHA="5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1"
|
||||
GO_VERSION_SHA="000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02"
|
||||
|
||||
# Download Go and verify Go tarball
|
||||
setup_go () {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
set -eux
|
||||
|
||||
ARCH=$(uname -m)
|
||||
GO_VERSION="1.20"
|
||||
GO_VERSION_SHA_arm64="32864d6fe888714ca7b421b5997269c7f6349d7e2675c3a399133e521787608b" # from https://golang.org/dl
|
||||
GO_VERSION_SHA_amd64="777025500f62d14bb5a4923072cd97431887961d24de08433a60c2fe1120531d" # from https://golang.org/dl
|
||||
GO_VERSION="1.20.1"
|
||||
GO_VERSION_SHA_arm64="f1a8e06c7f1ba1c008313577f3f58132eb166a41ceb95ce6e9af30bc5a3efca4" # from https://golang.org/dl
|
||||
GO_VERSION_SHA_amd64="a300a45e801ab459f3008aae5bb9efbe9a6de9bcd12388f5ca9bbd14f70236de" # from https://golang.org/dl
|
||||
|
||||
if [ "$ARCH" = 'arm64' ]; then
|
||||
GO_ARCH="darwin-arm64"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eux
|
||||
|
||||
GO_VERSION="1.20"
|
||||
GO_VERSION="1.20.1"
|
||||
|
||||
setup_go () {
|
||||
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/go-semver/semver"
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
|
|
@ -43,6 +44,12 @@ func removeZeroPatch(version string) string {
|
|||
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)
|
||||
return fmt.Sprintf("%d.%d", verInfo.Major, verInfo.Minor)
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
|
@ -107,6 +114,10 @@ func findHashes(body io.Reader, version string) (map[string]string, error) {
|
|||
|
||||
// Reached end of table
|
||||
if tokenType == html.EndTagToken && htmlTokens.Token().Data == "table" {
|
||||
if len(hashes) == 0 {
|
||||
return nil, fmt.Errorf("could not find version %q on downloads page", version)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("only found %d hashes expected %d: %v", len(hashes), len(artifacts), hashes)
|
||||
}
|
||||
}
|
||||
|
|
@ -130,13 +141,15 @@ func main() {
|
|||
if strings.HasPrefix(version, "v") {
|
||||
version = strings.TrimLeft(version, "v")
|
||||
}
|
||||
zeroPatchVersion := removeZeroPatch(version)
|
||||
|
||||
hashes, err := getHashes(version)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
zeroPatchVersion := removeZeroPatch(version)
|
||||
noPatchVersion := removePatch(version)
|
||||
|
||||
files := []FileInfo{
|
||||
{
|
||||
FileName: ".circleci/config.yml",
|
||||
|
|
@ -146,7 +159,12 @@ func main() {
|
|||
{
|
||||
FileName: ".github/workflows/golangci-lint.yml",
|
||||
Regex: `(go-version).*`,
|
||||
Replace: fmt.Sprintf("$1: '%s'", zeroPatchVersion),
|
||||
Replace: fmt.Sprintf("$1: '%s'", noPatchVersion),
|
||||
},
|
||||
{
|
||||
FileName: "go.mod",
|
||||
Regex: `(go)\s(\d.\d*)`,
|
||||
Replace: fmt.Sprintf("$1 %s", noPatchVersion),
|
||||
},
|
||||
{
|
||||
FileName: "Makefile",
|
||||
|
|
|
|||
Loading…
Reference in New Issue