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

bug: 在 json 转 go 时,不会合并 struct #117

Open
laushunyu opened this issue Jan 15, 2024 · 0 comments
Open

bug: 在 json 转 go 时,不会合并 struct #117

laushunyu opened this issue Jan 15, 2024 · 0 comments

Comments

@laushunyu
Copy link

{
"pod": [
{"memory": {"rss": 4,"availableBytes": 12}},
{"memory": {"rss": 4}}
]
}

out:

type AutoGenerated struct {
	Pod []Pod `json:"pod"`
}
type Memory struct {
	Rss            int `json:"rss"`
	AvailableBytes int `json:"availableBytes"`
}
type Memory0 struct {
	Rss int `json:"rss"`
}
type Pod struct {
	Memory  Memory  `json:"memory,omitempty"`
	Memory0 Memory0 `json:"memory,omitempty"`
}

expected:

type AutoGenerated struct {
	Pod []Pod `json:"pod"`
}
type Memory struct {
	Rss            int `json:"rss"`
	AvailableBytes int `json:"availableBytes,omitempty"`
}
type Pod struct {
	Memory  Memory  `json:"memory,omitempty"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant