chore: fix issues with Go 1.18 in CI (#416)
This commit is contained in:
parent
d3e0efb560
commit
56a8276a4a
@ -6,7 +6,7 @@ executors:
|
||||
# NOTE: To upgrade the Go version, first push the upgrade to the cross-builder Dockerfile in the edge repo,
|
||||
# then update the version here to match. Until we finish the migration to using the cross-builder image,
|
||||
# you'll also need to update references to `cimg/go` and `GO_VERSION` in this file.
|
||||
- image: quay.io/influxdb/cross-builder:go1.18.3-c75d304717395a43913dcc3d576d4f3545375253
|
||||
- image: quay.io/influxdb/cross-builder:go1.18.3-9a328a73f91e192f00c7645fef1b5d703e120ea2
|
||||
resource_class: medium
|
||||
linux-amd64:
|
||||
machine:
|
||||
|
@ -67,9 +67,8 @@ func Test_SimpleCreate(t *testing.T) {
|
||||
require.NoError(t, client.Create(context.Background(), ¶ms))
|
||||
}
|
||||
|
||||
func strFactory(arg interface{}) *string {
|
||||
val := (arg.(string)) // Docker image runs Go 1.17, so we can't use generics here.
|
||||
return &val
|
||||
func ptrFactory[T any](arg T) *T {
|
||||
return &arg
|
||||
}
|
||||
|
||||
func Test_SimpleList(t *testing.T) {
|
||||
@ -78,21 +77,20 @@ func Test_SimpleList(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
scriptsApi := mock.NewMockInvokableScriptsApi(ctrl)
|
||||
|
||||
language := api.SCRIPTLANGUAGE_FLUX
|
||||
scripts := []api.Script{{
|
||||
Id: strFactory("123456789"),
|
||||
Id: ptrFactory("123456789"),
|
||||
Name: "simple",
|
||||
Description: strFactory("First script"),
|
||||
Description: ptrFactory("First script"),
|
||||
OrgID: "1111111111111",
|
||||
Script: `from(bucket: "sample_data") |> range(start: -10h)`,
|
||||
Language: &language,
|
||||
Language: ptrFactory(api.SCRIPTLANGUAGE_FLUX),
|
||||
}, {
|
||||
Id: strFactory("000000001"),
|
||||
Id: ptrFactory("000000001"),
|
||||
Name: "another",
|
||||
Description: strFactory("Second script"),
|
||||
Description: ptrFactory("Second script"),
|
||||
OrgID: "9111111111119",
|
||||
Script: `from(bucket: "sample_data") |> range(start: -5h)`,
|
||||
Language: &language,
|
||||
Language: ptrFactory(api.SCRIPTLANGUAGE_FLUX),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net/url"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/influx-cli/v2/api"
|
||||
"github.com/influxdata/influx-cli/v2/clients"
|
||||
@ -96,7 +97,7 @@ func newApiClient(ctx *cli.Context, configSvc config.Service, injectToken bool)
|
||||
|
||||
if ctx.IsSet(extraHttpHeaderFlagName) {
|
||||
for _, h := range ctx.StringSlice(extraHttpHeaderFlagName) {
|
||||
k, v, ok := stringsCut(h, ":")
|
||||
k, v, ok := strings.Cut(h, ":")
|
||||
if !ok {
|
||||
return nil, fmt.Errorf(`header flag syntax "key:value", missing value in %q`, h)
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
//go:build go1.18
|
||||
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
func stringsCut(s, sep string) (before, after string, found bool) {
|
||||
return strings.Cut(s, sep)
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
//go:build !go1.18
|
||||
|
||||
// remove this backward compat shim once we either:
|
||||
// a) upgrade cross-builder docker image in https://github.com/influxdata/edge/
|
||||
// b) switch the CI system for this repo away from using cross-builder docker image.
|
||||
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
func stringsCut(s, sep string) (before, after string, found bool) {
|
||||
if i := strings.Index(s, sep); i >= 0 {
|
||||
return s[:i], s[i+len(sep):], true
|
||||
}
|
||||
return s, "", false
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
declare -r GO_VERSION=1.18.1
|
||||
declare -r GO_VERSION=1.18.3
|
||||
|
||||
# Hashes are from the table at https://golang.org/dl/
|
||||
function go_hash () {
|
||||
case $1 in
|
||||
linux_amd64)
|
||||
echo b3b815f47ababac13810fc6021eb73d65478e0b2db4b09d348eefad9581a2334
|
||||
echo 956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245
|
||||
;;
|
||||
linux_arm64)
|
||||
echo 56a91851c97fb4697077abbca38860f735c32b38993ff79b088dac46e4735633
|
||||
echo beacbe1441bee4d7978b900136d1d6a71d150f0a9bb77e9d50c822065623a35a
|
||||
;;
|
||||
mac)
|
||||
echo 63e5035312a9906c98032d9c73d036b6ce54f8632b194228bd08fe3b9fe4ab01
|
||||
echo a23a24c5528671d444328a36a98056902f699a5a211b6ad5db29ca0c012e0085
|
||||
;;
|
||||
windows)
|
||||
echo c30bc3f1f7314a953fe208bd9cd5e24bd9403392a6c556ced3677f9f70f71fe1
|
||||
echo 9c46023f3ad0300fcfd1e62f2b6c2dfd9667b1f2f5c7a720b14b792af831f071
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user