Skip to content

Commit 56a8276

Browse files
authored
chore: fix issues with Go 1.18 in CI (#416)
1 parent d3e0efb commit 56a8276

File tree

6 files changed

+16
-42
lines changed

6 files changed

+16
-42
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ executors:
66
# NOTE: To upgrade the Go version, first push the upgrade to the cross-builder Dockerfile in the edge repo,
77
# then update the version here to match. Until we finish the migration to using the cross-builder image,
88
# you'll also need to update references to `cimg/go` and `GO_VERSION` in this file.
9-
- image: quay.io/influxdb/cross-builder:go1.18.3-c75d304717395a43913dcc3d576d4f3545375253
9+
- image: quay.io/influxdb/cross-builder:go1.18.3-9a328a73f91e192f00c7645fef1b5d703e120ea2
1010
resource_class: medium
1111
linux-amd64:
1212
machine:

clients/script/script_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ func Test_SimpleCreate(t *testing.T) {
6767
require.NoError(t, client.Create(context.Background(), &params))
6868
}
6969

70-
func strFactory(arg interface{}) *string {
71-
val := (arg.(string)) // Docker image runs Go 1.17, so we can't use generics here.
72-
return &val
70+
func ptrFactory[T any](arg T) *T {
71+
return &arg
7372
}
7473

7574
func Test_SimpleList(t *testing.T) {
@@ -78,21 +77,20 @@ func Test_SimpleList(t *testing.T) {
7877
ctrl := gomock.NewController(t)
7978
scriptsApi := mock.NewMockInvokableScriptsApi(ctrl)
8079

81-
language := api.SCRIPTLANGUAGE_FLUX
8280
scripts := []api.Script{{
83-
Id: strFactory("123456789"),
81+
Id: ptrFactory("123456789"),
8482
Name: "simple",
85-
Description: strFactory("First script"),
83+
Description: ptrFactory("First script"),
8684
OrgID: "1111111111111",
8785
Script: `from(bucket: "sample_data") |> range(start: -10h)`,
88-
Language: &language,
86+
Language: ptrFactory(api.SCRIPTLANGUAGE_FLUX),
8987
}, {
90-
Id: strFactory("000000001"),
88+
Id: ptrFactory("000000001"),
9189
Name: "another",
92-
Description: strFactory("Second script"),
90+
Description: ptrFactory("Second script"),
9391
OrgID: "9111111111119",
9492
Script: `from(bucket: "sample_data") |> range(start: -5h)`,
95-
Language: &language,
93+
Language: ptrFactory(api.SCRIPTLANGUAGE_FLUX),
9694
},
9795
}
9896

cmd/influx/global.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"net/url"
88
"runtime"
9+
"strings"
910

1011
"github.com/influxdata/influx-cli/v2/api"
1112
"github.com/influxdata/influx-cli/v2/clients"
@@ -96,7 +97,7 @@ func newApiClient(ctx *cli.Context, configSvc config.Service, injectToken bool)
9697

9798
if ctx.IsSet(extraHttpHeaderFlagName) {
9899
for _, h := range ctx.StringSlice(extraHttpHeaderFlagName) {
99-
k, v, ok := stringsCut(h, ":")
100+
k, v, ok := strings.Cut(h, ":")
100101
if !ok {
101102
return nil, fmt.Errorf(`header flag syntax "key:value", missing value in %q`, h)
102103
}

cmd/influx/util.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

cmd/influx/util_go117.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

scripts/ci/install-go.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/usr/bin/env bash
22
set -eo pipefail
33

4-
declare -r GO_VERSION=1.18.1
4+
declare -r GO_VERSION=1.18.3
55

66
# Hashes are from the table at https://golang.org/dl/
77
function go_hash () {
88
case $1 in
99
linux_amd64)
10-
echo b3b815f47ababac13810fc6021eb73d65478e0b2db4b09d348eefad9581a2334
10+
echo 956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245
1111
;;
1212
linux_arm64)
13-
echo 56a91851c97fb4697077abbca38860f735c32b38993ff79b088dac46e4735633
13+
echo beacbe1441bee4d7978b900136d1d6a71d150f0a9bb77e9d50c822065623a35a
1414
;;
1515
mac)
16-
echo 63e5035312a9906c98032d9c73d036b6ce54f8632b194228bd08fe3b9fe4ab01
16+
echo a23a24c5528671d444328a36a98056902f699a5a211b6ad5db29ca0c012e0085
1717
;;
1818
windows)
19-
echo c30bc3f1f7314a953fe208bd9cd5e24bd9403392a6c556ced3677f9f70f71fe1
19+
echo 9c46023f3ad0300fcfd1e62f2b6c2dfd9667b1f2f5c7a720b14b792af831f071
2020
;;
2121
esac
2222
}

0 commit comments

Comments
 (0)