Skip to content

util/gconv: The omitempty attribute in JSON is ineffective #4023

@joyouswind

Description

@joyouswind

Go version

go 1.22.4 linux/arm64

GoFrame version

2.8.1

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

Testing GET requests, the omitempty attribute in JSON is ineffective. This issue was not observed in version 2.4.

client.GetVar(ctx, url, params).Scan(&result)

What did you see happen?

The upgrade of gconv in #3170 has affected gclient requests. Inside the HTTP request, httputil.BuildParams uses gconv.Map, and the internal logic only ignores omitempty when MapOption's OmitEmpty is set to true. It seems there is no place to set this policy.

56e2a83a0fbf59eed6b9dd3482aa904

What did you expect to see?

the omitempty attribute I want the omitempty attribute in JSON to take effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIt is confirmed a bug, but don't worry, we'll handle it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions