chore: fix issues with Go 1.18 in CI (#416)
This commit is contained in:
@ -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
|
||||
}
|
Reference in New Issue
Block a user