Use singular/plural form on GitOps log messages as appropriate - #33675
Conversation
Also replaces existing pluralization function so everything in GitOps is using the same thing Note that this doesn't add counts to log messages where they aren't currently, nor does it change logic on what count we actually show. Fixes #33199.
| if n == 1 { | ||
| return fmt.Sprintf("%d %s", n, singular) | ||
| } | ||
| return fmt.Sprintf("%d %s", n, plural) |
There was a problem hiding this comment.
| if n == 1 { | |
| return fmt.Sprintf("%d %s", n, singular) | |
| } | |
| return fmt.Sprintf("%d %s", n, plural) | |
| return fmt.Sprintf("%s %s", n, n == 1 ? singular : plural) |
lol jk golang doesn't believe in ternaries
There was a problem hiding this comment.
nor does it believe in optional arguments, which would let you leave off the third arg in most cases.
sgress454
left a comment
There was a problem hiding this comment.
Didn't actually test each of these cases but I ran my pencil down the page and they all look right + it's low risk and there's some tests. Thanks for the nice standardization!
| if n == 1 { | ||
| return fmt.Sprintf("%d %s", n, singular) | ||
| } | ||
| return fmt.Sprintf("%d %s", n, plural) |
There was a problem hiding this comment.
nor does it believe in optional arguments, which would let you leave off the third arg in most cases.
|
@sgress454 thx for the review! I need to run through the entire test plan (which I just finished writing) before merging this; fingers crossed I don't find anything in the process. Otherwise I'll make sure any fix commits are up prior to tmw AM. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #33675 +/- ##
==========================================
- Coverage 64.02% 64.02% -0.01%
==========================================
Files 2067 2067
Lines 207065 207037 -28
Branches 6854 6854
==========================================
- Hits 132574 132547 -27
+ Misses 64065 64064 -1
Partials 10426 10426 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Also replaces existing pluralization function so everything in GitOps is using the same thing
Note that this doesn't add counts to log messages where they aren't currently, nor does it change logic on what count we actually show.
Fixes #33199.
Related issue: Resolves #
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
Added/updated automated tests
QA'd all new/changed functionality manually