Skip to content

reflect.DeepEqual fails with *js.Object types #473

Closed
@bep

Description

@bep

See http://www.gopherjs.org/playground/#/54CnvrqcGt

package main

import (
    "github.com/gopherjs/gopherjs/js"
    "reflect"
)

type Val struct {
    *js.Object
    Name string
}

func main() {

    v1 := &Val{Object: js.Global.Get("Object").New(), Name: "v1"}
    v2 := &Val{Object: js.Global.Get("Object").New(), Name: "v2"}

    eq := reflect.DeepEqual(v1, v2)

    println("Eq:", eq)
}

Tracking down Uncaught RangeError: Maximum call stack size exceeded errors has been the number one pain in a otherwise very enjoyable GopherJS experience. Once I managed to get the complete stacktraces from the browser, the causes are obvious.

But the example above isn't obvious to me.

I can understand why a circular referenced object should fail (however, you should consider document it as a difference between the Go stdlib), but the abvove I would expect to plainly return false. But there may be stuff here I don't see.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions