diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-23 23:46:47 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-23 23:46:47 +0300 |
| commit | 5e52d5ce222d9dd65c343b5b99c6b1b15ce54fe1 (patch) | |
| tree | db6e917281cf1688127acc33d690f69580379518 | |
| parent | 728be50718cf0b5fb46aa01ddceae5780652c05e (diff) | |
fix(rpn): correct misleading comment in parseCategory
The comment incorrectly stated the function iterates 'using range'
(Go's range keyword), but it actually uses a for loop bounded by
_sentinel. Also removed the misleading OCP compliance claim since
adding new Category constants also requires updating the String()
switch statement.
| -rw-r--r-- | internal/rpn/operations_metric_cmd.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/rpn/operations_metric_cmd.go b/internal/rpn/operations_metric_cmd.go index 868c92a..1915507 100644 --- a/internal/rpn/operations_metric_cmd.go +++ b/internal/rpn/operations_metric_cmd.go @@ -81,9 +81,9 @@ func (o *Operations) MetricCompatible(stack *Stack) (string, error) { } // parseCategory converts a category name string to a Category constant. -// Iterates over all valid Category values using range, so adding a new -// Category constant (between Universal and _sentinel) automatically makes -// it available here without modifying this function (OCP compliance). +// Iterates over all valid Category values using a for loop bounded by _sentinel, +// so adding a new Category constant (between Universal and _sentinel) automatically +// makes it available here without modifying this function. func parseCategory(name string) (Category, bool) { for cat := Category(0); cat <= _sentinel; cat++ { if cat.String() == name { |
