From 3ccd0b53c9e448daf2fb055e87cc88ff8b3b841c Mon Sep 17 00:00:00 2001 From: Jeffrey Faer Date: Mon, 9 Mar 2026 09:47:08 -0600 Subject: [PATCH] style: Special case IntOrBool 1 and 0 values to yes and no. --- keepsorted/options.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/keepsorted/options.go b/keepsorted/options.go index e36d20d..551f3be 100644 --- a/keepsorted/options.go +++ b/keepsorted/options.go @@ -233,7 +233,14 @@ func formatValue(val reflect.Value) (string, error) { case reflect.TypeFor[map[string]bool](): return formatList(slices.Sorted(maps.Keys(val.Interface().(map[string]bool)))) case reflect.TypeFor[IntOrBool](): - return strconv.Itoa(int(val.Int())), nil + switch i := int(val.Int()); i { + case 0: + return boolString[false], nil + case 1: + return boolString[true], nil + default: + return strconv.Itoa(i), nil + } case reflect.TypeFor[int](): return strconv.Itoa(int(val.Int())), nil case reflect.TypeFor[[]ByRegexOption]():