[#1689] linter: Fix staticcheck warning: 'Use fmt.Fprintf(...) instead of WriteString(fmt.Sprintf(...))'
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m18s
Pre-commit hooks / Pre-commit (push) Successful in 1m44s
Build / Build Components (push) Successful in 1m49s
Tests and linters / Run gofumpt (push) Successful in 3m20s
Tests and linters / gopls check (push) Successful in 3m44s
Tests and linters / Staticcheck (push) Successful in 3m47s
Tests and linters / Lint (push) Successful in 4m16s
Tests and linters / Tests (push) Successful in 4m17s
OCI image / Build container images (push) Successful in 4m51s
Tests and linters / Tests with -race (push) Successful in 5m39s
All checks were successful
Vulncheck / Vulncheck (push) Successful in 1m18s
Pre-commit hooks / Pre-commit (push) Successful in 1m44s
Build / Build Components (push) Successful in 1m49s
Tests and linters / Run gofumpt (push) Successful in 3m20s
Tests and linters / gopls check (push) Successful in 3m44s
Tests and linters / Staticcheck (push) Successful in 3m47s
Tests and linters / Lint (push) Successful in 4m16s
Tests and linters / Tests (push) Successful in 4m17s
OCI image / Build container images (push) Successful in 4m51s
Tests and linters / Tests with -race (push) Successful in 5m39s
Change-Id: I253ab717885cb01b4a2e471147e883ee351be277 Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
b0ef737a74
commit
f4696e8964
1 changed files with 7 additions and 7 deletions
|
@ -296,7 +296,7 @@ func appendEstimation(sb *strings.Builder, resp *control.GetShardEvacuationStatu
|
|||
leftSeconds := avgObjEvacuationTimeSeconds * objectsLeft
|
||||
leftMinutes := int(leftSeconds / 60)
|
||||
|
||||
sb.WriteString(fmt.Sprintf(" Estimated time left: %d minutes.", leftMinutes))
|
||||
fmt.Fprintf(sb, " Estimated time left: %d minutes.", leftMinutes)
|
||||
}
|
||||
|
||||
func appendDuration(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
|
||||
|
@ -305,20 +305,20 @@ func appendDuration(sb *strings.Builder, resp *control.GetShardEvacuationStatusR
|
|||
hour := int(duration.Seconds() / 3600)
|
||||
minute := int(duration.Seconds()/60) % 60
|
||||
second := int(duration.Seconds()) % 60
|
||||
sb.WriteString(fmt.Sprintf(" Duration: %02d:%02d:%02d.", hour, minute, second))
|
||||
fmt.Fprintf(sb, " Duration: %02d:%02d:%02d.", hour, minute, second)
|
||||
}
|
||||
}
|
||||
|
||||
func appendStartedAt(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
|
||||
if resp.GetBody().GetStartedAt() != nil {
|
||||
startedAt := time.Unix(resp.GetBody().GetStartedAt().GetValue(), 0).UTC()
|
||||
sb.WriteString(fmt.Sprintf(" Started at: %s UTC.", startedAt.Format(time.RFC3339)))
|
||||
fmt.Fprintf(sb, " Started at: %s UTC.", startedAt.Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
|
||||
func appendError(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
|
||||
if len(resp.GetBody().GetErrorMessage()) > 0 {
|
||||
sb.WriteString(fmt.Sprintf(" Error: %s.", resp.GetBody().GetErrorMessage()))
|
||||
fmt.Fprintf(sb, " Error: %s.", resp.GetBody().GetErrorMessage())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ func appendStatus(sb *strings.Builder, resp *control.GetShardEvacuationStatusRes
|
|||
default:
|
||||
status = "undefined"
|
||||
}
|
||||
sb.WriteString(fmt.Sprintf(" Status: %s.", status))
|
||||
fmt.Fprintf(sb, " Status: %s.", status)
|
||||
}
|
||||
|
||||
func appendShardIDs(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
|
||||
|
@ -350,14 +350,14 @@ func appendShardIDs(sb *strings.Builder, resp *control.GetShardEvacuationStatusR
|
|||
}
|
||||
|
||||
func appendCounts(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
|
||||
sb.WriteString(fmt.Sprintf(" Evacuated %d objects out of %d, failed to evacuate: %d, skipped: %d; evacuated %d trees out of %d, failed to evacuate: %d.",
|
||||
fmt.Fprintf(sb, " Evacuated %d objects out of %d, failed to evacuate: %d, skipped: %d; evacuated %d trees out of %d, failed to evacuate: %d.",
|
||||
resp.GetBody().GetEvacuatedObjects(),
|
||||
resp.GetBody().GetTotalObjects(),
|
||||
resp.GetBody().GetFailedObjects(),
|
||||
resp.GetBody().GetSkippedObjects(),
|
||||
resp.GetBody().GetEvacuatedTrees(),
|
||||
resp.GetBody().GetTotalTrees(),
|
||||
resp.GetBody().GetFailedTrees()))
|
||||
resp.GetBody().GetFailedTrees())
|
||||
}
|
||||
|
||||
func initControlEvacuationShardCmd() {
|
||||
|
|
Loading…
Add table
Reference in a new issue