http://www.gopherjs.org/play/#/uhMTBoBe53
angular.js:9937 Error: Unhandled object: *types.Builtin
Is there any semantic difference between go close(ch) and close(ch)?
/cc @shurcooL
In GopherJS, callbacks should not be blocked by e.g. close and in this case go is necessary. BTW, go func() { close(ch) }() worked.
close should not be considered as blocking. If it is, then that's a bug.
Ah, I was misunderstanding. Thanks. go close(ch) should be compiled without errors anyway.
close should not be blocking indeed.
Is there any semantic difference between
go close(ch)andclose(ch)?
Yes, there is. Consider:
ch := make(chan struct{})
close(ch)
select {
case <-ch:
fmt.Println("a")
default:
fmt.Println("b")
}
That program is always going to output "a" only. But if you use go close(ch), it will print "a" or "b".
In the context of GopherJS, however, it should be save to transform go close(ch) to close(ch). That's a valid way of scheduling the operation.
Do note that there are other built-ins that probably fail compilation right now, such as go delete(...)