xtools icon indicating copy to clipboard operation
xtools copied to clipboard

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

Open laushunyu opened this issue 1 year ago • 0 comments

{
"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"`
}

laushunyu avatar Jan 15 '24 09:01 laushunyu