Skip to content

Commit

Permalink
Fix format string for go1.18 (#3596)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bobrik authored Mar 24, 2022
1 parent f1ac025 commit e08f5c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/es/client/cluster_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/es/client/cluster_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e08f5c0

Please sign in to comment.