You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"github.com/imdario/mergo"
)
type Foo struct {
A int
B int
C int
}
func main() {
dst := Foo{A: 0, B: 1, C: 2}
src := map[string]interface{}{
"A": 3, "B": 4, "C": 0,
}
mergo.Map(&dst, src, mergo.WithOverride)
fmt.Printf("%+v\n", dst)
}
Expected result: {A:3 B:4 C:0}
Actual result: {A:3 B:4 C:2}
Looks like Overwrite ignores Value if it is zero.
But it must overwrite struct field in case map have the corresponding key set. Regardless of it's value
The text was updated successfully, but these errors were encountered:
Expected result:
{A:3 B:4 C:0}
Actual result:
{A:3 B:4 C:2}
Looks like Overwrite ignores Value if it is zero.
But it must overwrite struct field in case map have the corresponding key set. Regardless of it's value
The text was updated successfully, but these errors were encountered: