Skip to content

Commit

Permalink
handler: default to unmodified field name, as encoding/json
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
creachadair committed Jan 18, 2023
1 parent 3ea9a41 commit 349ce26
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions handler/positional.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 349ce26

Please sign in to comment.