Skip to content

Encoding options are ignored for interface-valued slice elements #195

Open

Description

@yuefdev

Encoding options work for typed slices but are ignored for the same values inside []interface{}:

v, _ := query.Values(struct {
    V []interface{} `url:",space,int"`
}{[]interface{}{true, false}})
fmt.Println(v.Get("V")) // true false; expected 1 0

A time.Time element similarly ignores a field's layout tag and uses fmt.Sprint instead.

Reproduced on current main with Go 1.27. I have a small fix that unwraps non-nil interfaces in valueString; both regressions failed first and the full tests now pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions