Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bep opened this issue Jun 8, 2016 · 2 comments
Closed

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

bep opened this issue Jun 8, 2016 · 2 comments
Labels

Comments

@bep
Copy link

bep commented Jun 8, 2016

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.

@dmitshur dmitshur added the bug label Jun 8, 2016
@dmitshur
Copy link
Member

dmitshur commented Jun 8, 2016

I can reproduce.

reflect package is marked as fully supported in the compatibility table, so this is a valid bug.

@dmitshur
Copy link
Member

dmitshur commented Sep 14, 2016

Confirmed fixed.

I've regenerated the playground and it's working there too now.

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

Output is Eq: false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants