From 349ce267f5f75f93bd02b6d3b41bf2b66301f544 Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Tue, 17 Jan 2023 16:48:59 -0800 Subject: [PATCH] handler: default to unmodified field name, as encoding/json When assigning positional names, use the same rule that encoding/json does for unlabelled fields, viz., the field-name as spelled. The encoder already handles case-insensitive lookup. --- handler/positional.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/handler/positional.go b/handler/positional.go index 539fb79..e68e35a 100644 --- a/handler/positional.go +++ b/handler/positional.go @@ -61,8 +61,7 @@ func structFieldNames(atype reflect.Type) (bool, []string) { // handled by the cases above. continue } - name := strings.ToLower(fi.Name[:1]) + fi.Name[1:] - names = append(names, name) + names = append(names, fi.Name) } return true, names }