You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
query: omitempty is ignored on anonymous struct fields #198
An anonymous struct field tagged url:",omitempty" is always traversed, even when its IsZero method returns true. Giving the same field an explicit URL name correctly omits it.
Reproduction on master (965d79f2113ea0ff039d29828a08a616a0223d48), Go 1.26.8, linux/amd64:
Actual: "search=", <nil>.
Expected: "", <nil>, consistent with the documented omitempty behavior for types implementing IsZero.
reflectValue queues anonymous structs for recursive traversal before reaching its omitempty check. I am preparing a small fix that checks omission before that step, with regression tests and preservation of exported fields promoted from unexported embedded structs.
Activity