diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 10:12:28 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 10:12:28 +0300 |
| commit | ff836d0d287ef1378fb36f68037e7725a661cf7a (patch) | |
| tree | 34884f0a8c8cdf332386e93f1e7aded03913b14d | |
| parent | a963fd6f854d476ec838fbde7ae3c28cd4270c97 (diff) | |
fix(rpn): use < instead of <= for _sentinel in parseCategory
parseCategory iterated over _sentinel itself, causing it to return
true for the sentinel value (an invalid category). Use strict less-
than so only valid categories match.
| -rw-r--r-- | internal/rpn/operations_metric_cmd.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/rpn/operations_metric_cmd.go b/internal/rpn/operations_metric_cmd.go index 61e3f82..8e0e519 100644 --- a/internal/rpn/operations_metric_cmd.go +++ b/internal/rpn/operations_metric_cmd.go @@ -85,7 +85,7 @@ func (o *Operations) MetricCompatible(stack *Stack) (string, error) { // 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++ { + for cat := Category(0); cat < _sentinel; cat++ { if cat.String() == name { return cat, true } |
