Open
Description
Why doesn't t1.foo == nil, after I just assigned it nil? Why doesn't it even == itself?
type foo struct {
*js.Object
bar bool `js:"bar"`
}
type t struct {
*js.Object
*foo `js:"foo"`
}
t1 := t{Object: js.Global.Get("Object").New()}
t1.foo = nil
// => "t1.foo != nil"
if t1.foo == nil {
fmt.Println("t1.foo == nil")
} else {
fmt.Println("t1.foo != nil")
}
fmt.Printf("t1.foo is %v\n", t1.foo) // => "t1.foo is null"
// => "t1.foo != itself"
if t1.foo == t1.foo {
fmt.Println("t1.foo == itself")
} else {
fmt.Println("t1.foo != itself")
}
Am I doing something wrong? Is there a better way to deal with this?