From e08f5c0c3a133b7ffe8e42e8485570900af815b6 Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Thu, 24 Mar 2022 04:18:41 -0700 Subject: [PATCH] Fix format string for go1.18 (#3596) Fixing this error: ``` pkg/es/client/cluster_client.go:54:13: fmt.Errorf format %w has arg versionField of wrong type interface{} ``` Signed-off-by: Ivan Babrou --- pkg/es/client/cluster_client.go | 2 +- pkg/es/client/cluster_client_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/es/client/cluster_client.go b/pkg/es/client/cluster_client.go index dfa7df0a881..a3e86eef8f8 100644 --- a/pkg/es/client/cluster_client.go +++ b/pkg/es/client/cluster_client.go @@ -51,7 +51,7 @@ func (c *ClusterClient) Version() (uint, error) { versionField := info.Version["number"] versionNumber, isString := versionField.(string) if !isString { - return 0, fmt.Errorf("invalid version format: %w", versionField) + return 0, fmt.Errorf("invalid version format: %v", versionField) } version := strings.Split(versionNumber, ".") major, err := strconv.ParseUint(version[0], 10, 32) diff --git a/pkg/es/client/cluster_client_test.go b/pkg/es/client/cluster_client_test.go index f979b794ada..67a8ebe3511 100644 --- a/pkg/es/client/cluster_client_test.go +++ b/pkg/es/client/cluster_client_test.go @@ -161,7 +161,7 @@ func TestVersion(t *testing.T) { name: "bad version", responseCode: http.StatusOK, response: badVersionType, - errContains: "invalid version format: %!w(bool=true)", + errContains: "invalid version format: true", }, { name: "version not a number",