This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
How to handle key conflicts when using mapstructure:",squash" ? #356
Open
Description
type Order struct {
Id string
}
type User struct {
Id string
Order Order `mapstructure:",squash"`
}
result := map[string]interface{}{}
mapstructure.Decode(User{
Id: "userId",
Order: Order{
Id: "orderId",
},
}, &result)
log.Println(result)
Output: map[Id:orderId]
Expected: map[Id:userId Order.Id:orderId]
Metadata
Metadata
Assignees
Labels
No labels