Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/ghttp: issue req When requesting automatic parsing, the array will lose its order. #4098

Open
atishoo opened this issue Jan 4, 2025 · 6 comments
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.

Comments

@atishoo
Copy link

atishoo commented Jan 4, 2025

Go version

go1.23.4 darwin/arm64

GoFrame version

v2.8.2

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

v2.8.2
Welcome to GoFrame!
Env Detail:
Go Version: go1.23.4 darwin/arm64
GF Version(go.mod):
github.com/gogf/gf/contrib/drivers/mysql/[email protected]
github.com/gogf/gf/contrib/nosql/redis/[email protected]
github.com/gogf/gf/[email protected]
CLI Detail:
Installed At: /Users/yuanfang/go/bin/gf
Built Go Version: go1.23.4
Built GF Version: v2.8.2
Others Detail:
Docs: https://goframe.org
Now : 2025-01-05T00:37:23+08:00


type UpdateReq struct {
	g.Meta    `path:"/update" tags:"我的" method:"put" summary:"更新画廊"`
	Gallery   []string `json:"gallery" description:"画廊图库"`
}

这个代码,gallery 是有顺序的,但是每次 req.gallery 的顺序都一样

原始请求 json

{"gallery":["gallery/1/RQQvYT35NNq8-0005.JPG","gallery/1/U8JVo9K6n0wP-0004.JPG","gallery/1/WzpX0n5mZLQ2-111.HEIC","gallery/1/PeNjvlYChXRR-0001.JPG","gallery/1/pqXtggBQPI3X-0002.JPG","gallery/1/pvO3O18kplVw-0003.JPG"]}
===json.Unmarshal============
gallery/1/RQQvYT35NNq8-0005.JPG
gallery/1/U8JVo9K6n0wP-0004.JPG
gallery/1/WzpX0n5mZLQ2-111.HEIC
gallery/1/PeNjvlYChXRR-0001.JPG
gallery/1/pqXtggBQPI3X-0002.JPG
gallery/1/pvO3O18kplVw-0003.JPG
====json.Unmarshal===========
====req.Gallery===========
gallery/1/PeNjvlYChXRR-0001.JPG
gallery/1/RQQvYT35NNq8-0005.JPG
gallery/1/U8JVo9K6n0wP-0004.JPG
gallery/1/WzpX0n5mZLQ2-111.HEIC
gallery/1/pqXtggBQPI3X-0002.JPG
gallery/1/pvO3O18kplVw-0003.JPG
====req.Gallery===========

What did you see happen?

每次拿到的数据顺序都一样

What did you expect to see?

希望得到json.Unmarshal的原始顺序

@atishoo atishoo added the bug It is confirmed a bug, but don't worry, we'll handle it. label Jan 4, 2025
@Issues-translate-bot Issues-translate-bot changed the title os/gtime: issue req 请求自动解析时,数组会丢失顺序 os/gtime: issue req When requesting automatic parsing, the array will lose its order. Jan 4, 2025
@cyjaysong
Copy link
Contributor

cyjaysong commented Jan 8, 2025

issues 标题分类错误, 不是os/gtime

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


issues title classification error

@atishoo
Copy link
Author

atishoo commented Jan 8, 2025

issues 标题分类错误, 不是os/gtime

那应该是啥分类?ghttp?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Issues title is classified incorrectly, not os/gtime

What classification should it be? ghttp?

@cyjaysong
Copy link
Contributor

issues 标题分类错误, 不是os/gtime

那应该是啥分类?ghttp?

是的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Issues title is classified incorrectly, not os/gtime

What classification should it be? ghttp?

Yes

@atishoo atishoo changed the title os/gtime: issue req When requesting automatic parsing, the array will lose its order. os/ghttp: issue req When requesting automatic parsing, the array will lose its order. Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It is confirmed a bug, but don't worry, we'll handle it.
Projects
None yet
Development

No branches or pull requests

3 participants