remove unneccessary fmt.Sprintf's

This commit is contained in:
2026-07-07 06:43:34 +02:00
parent 86f17329b0
commit 3abe8b62a2
2 changed files with 13 additions and 13 deletions

View File

@@ -256,8 +256,8 @@ func gatherClusterStats(conf *cfg.Config, clusterstats *clusterstats.Response, t
} }
table.Entries = append(table.Entries, [][]any{ table.Entries = append(table.Entries, [][]any{
{"Indicies", fmt.Sprintf("%d", clusterstats.Indices.Count)}, {"Indicies", clusterstats.Indices.Count},
{"Docs", fmt.Sprintf("%d", clusterstats.Indices.Docs.Count)}, {"Docs", clusterstats.Indices.Docs.Count},
{"Total Size", printer.Bytes(clusterstats.Indices.Docs.TotalSizeInBytes)}, {"Total Size", printer.Bytes(clusterstats.Indices.Docs.TotalSizeInBytes)},
{"Total Queries", "%d", querycount}, {"Total Queries", "%d", querycount},
{"Shards Primaries", clusterstats.Indices.Shards.Primaries}, {"Shards Primaries", clusterstats.Indices.Shards.Primaries},

View File

@@ -79,20 +79,20 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
printer.Colorize(conf, status[follower].Status.Name, status[follower].Status.Name), printer.Colorize(conf, status[follower].Status.Name, status[follower].Status.Name),
}, },
{"Active Shards", {"Active Shards",
fmt.Sprintf("%d", status[leader].ActiveShards), status[leader].ActiveShards,
fmt.Sprintf("%d", status[follower].ActiveShards), status[follower].ActiveShards,
}, },
{"Active Primary Shards", {"Active Primary Shards",
fmt.Sprintf("%d", status[leader].ActivePrimaryShards), status[leader].ActivePrimaryShards,
fmt.Sprintf("%d", status[follower].ActivePrimaryShards), status[follower].ActivePrimaryShards,
}, },
{"Indicies", {"Indicies",
fmt.Sprintf("%d", len(status[leader].Indices)), len(status[leader].Indices),
fmt.Sprintf("%d", len(status[follower].Indices)), len(status[follower].Indices),
}, },
{"Nodes", {"Nodes",
fmt.Sprintf("%d", status[leader].NumberOfNodes), status[leader].NumberOfNodes,
fmt.Sprintf("%d", status[follower].NumberOfNodes), status[follower].NumberOfNodes,
}, },
} }
@@ -112,7 +112,7 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
// finds indices on both clusters which have ilm errors // finds indices on both clusters which have ilm errors
func findIlmErrors(conf *cfg.Config, leader, follower string) bool { func findIlmErrors(conf *cfg.Config, leader, follower string) bool {
failed := map[string]map[string]string{} failed := map[string]map[string]any{}
for _, cluster := range []string{leader, follower} { for _, cluster := range []string{leader, follower} {
ilm, err := conf.Clusters[cluster].ES().Ilm.ExplainLifecycle("_all"). ilm, err := conf.Clusters[cluster].ES().Ilm.ExplainLifecycle("_all").
@@ -123,13 +123,13 @@ func findIlmErrors(conf *cfg.Config, leader, follower string) bool {
return false return false
} }
failed[cluster] = map[string]string{} failed[cluster] = map[string]any{}
for name, ilmstate := range ilm.Indices { for name, ilmstate := range ilm.Indices {
count := ilmstate.(*types.LifecycleExplainManaged).FailedStepRetryCount count := ilmstate.(*types.LifecycleExplainManaged).FailedStepRetryCount
if count != nil && *count > 0 { if count != nil && *count > 0 {
failed[cluster][name] = fmt.Sprintf("%d", *count) failed[cluster][name] = *count
} }
} }
} }