Skip to content

Commit

Permalink
fix: use %t to print bools
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Oct 17, 2024
1 parent a98f5d4 commit cf4c298
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions k8sutils/pkg/describe/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,3 @@ func describeText(sb *strings.Builder, indent int, printftext string, args ...in
lineText := fmt.Sprintf(printftext, args...)
sb.WriteString(fmt.Sprintf("%s%s\n", indentText, lineText))
}

func boolToText(b bool) string {
if b {
return "True"
}
return "False"
}
8 changes: 4 additions & 4 deletions k8sutils/pkg/describe/odigos.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ func printClusterCollectorStatus(clusterCollector clusterCollectorResources, exp
describeText(sb, 2, wrapTextInRed("Deployed: Status Unavailable"))
} else {
if deployedCondition.Status == metav1.ConditionTrue {
describeText(sb, 2, wrapTextInGreen("Deployed: True"))
describeText(sb, 2, wrapTextInGreen("Deployed: true"))
} else {
describeText(sb, 2, wrapTextInRed("Deployed: False"))
describeText(sb, 2, wrapTextInRed("Deployed: false"))
describeText(sb, 2, wrapTextInRed(fmt.Sprintf("Reason: %s", deployedCondition.Message)))
}
}

ready := clusterCollector.CollectorsGroup.Status.Ready
describeText(sb, 2, wrapTextSuccessOfFailure(fmt.Sprintf("Ready: %s", boolToText(ready)), ready))
describeText(sb, 2, wrapTextSuccessOfFailure(fmt.Sprintf("Ready: %t", ready), ready))

if clusterCollector.LatestRevisionPods == nil || clusterCollector.Deployment == nil {
describeText(sb, 2, wrapTextInRed("Number of Replicas: Status Unavailable"))
Expand Down Expand Up @@ -231,7 +231,7 @@ func printNodeCollectorStatus(nodeCollector nodeCollectorResources, expectingNod
}

ready := nodeCollector.CollectorsGroup.Status.Ready
describeText(sb, 2, wrapTextSuccessOfFailure(fmt.Sprintf("Ready: %s", boolToText(ready)), ready))
describeText(sb, 2, wrapTextSuccessOfFailure(fmt.Sprintf("Ready: %t", ready), ready))

// this is copied from k8sutils/pkg/describe/describe.go
// I hope the info is accurate since there can be many edge cases
Expand Down

0 comments on commit cf4c298

Please sign in to comment.