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
As a workaround, it seems that changing go panic(e) to go func() { panic(e) }() in the singleflight library avoids the compiler panic.
(However, that's an awkward workaround; from a dependency-management perspective it would be preferable to use the upstream singleflight library directly, without having to adulterate it.)
@DaveHasteSpringer thanks for the report. Looks like the compiler doesn't expect the body of a goroutine to be a built-in function (such as panic), and this is indeed an odd way to write code. However, this is definitely a bug and I'll see of I can make a fix for it.
The root cause of the bug is similar: certain methods of js.Object type are normally compiled into JS expressions other than function calls, but it doesn't happen in conjunction with the go keyword.
Recent versions of golang.org/x/sync/singleflight cause a panic in the gopherjs compiler.
These are the versions of Go and GopherJS that I'm using:
This is the most concise test code I can use to reproduce the problem:
This is my go.mod file:
The code builds fine with the go compiler:
However the GopherJS compiler panics:
From what I can tell, this is the line that provokes the GopherJS compiler panic: https://cs.opensource.google/go/x/sync/+/036812b2:singleflight/singleflight.go;l=162
The text was updated successfully, but these errors were encountered: