-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
gconv.Struct: unexpected behaviour when conv to a string to list #4084
Comments
By the way, i don't found any document says what will happend using gconv on a list. Hope can add some document about it. Or if i missed out it. and i’m very thankful for anyone can paste a link here.. |
Let me have a check. |
@QisFj Hello, I see the problem is that package We're planning improve such behavior by adding internal Here's the code snips for improvement example:
We would be very appreciated if any friend can submit such contribution to improve function |
Go version
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?
What did you see happen?
I got
err==nil
andList = [0]
What did you expect to see?
i expected got
err != nil
; at least getlen(List) == 0
.I guess the reason is gf treat the
"[a]"
as a object. and when trying to set an object to list, will set it as a element. like[]any{"[a]"}
; and then trying to conver[]any{"[a]"}
to a[]int
, then use the default value0
, since it can't parse"[a]"
as a number.more input output:
"[1, 2]"
=>[]int{1, 2}
"[1, \"2\"]"
=>[]int{0}
by the way, if the List is not
[]int
, but[]*int
. It will return an error, which says failed to convint
to*int
. I guess its another bug..The text was updated successfully, but these errors were encountered: