Skip to content

Commit

Permalink
Fix format string for go1.18
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 <github@ivan.computer>
  • Loading branch information
bobrik committed Mar 22, 2022
1 parent c156ebd commit 6137a6a
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 6137a6a

Please sign in to comment.