What version of Go are you using (go version)?
tip (06b12e6)
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
js/wasm, and aix/ppc64
What did you do?
https://play.golang.org/p/6zD83-Dhd1P
package main
var x = 0
func main() {
defer func() { recover(); println(x) }()
f()
}
func f() {
var nilf func()
defer nilf()
x = 1
}
What did you expect to see?
The spec requires (https://golang.org/ref/spec#Defer_statements)
If a deferred function value evaluates to nil, execution panics when the function is invoked, not when the "defer" statement is executed.
So in the program above, the assignment x=1 should go through, so it should print 1.
What did you see instead?
Print 0 on Wasm and AIX.
I'll send a CL shortly.
cc @danscales
What version of Go are you using (
go version)?tip (06b12e6)
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?js/wasm, and aix/ppc64
What did you do?
https://play.golang.org/p/6zD83-Dhd1P
What did you expect to see?
The spec requires (https://golang.org/ref/spec#Defer_statements)
So in the program above, the assignment
x=1should go through, so it should print 1.What did you see instead?
Print 0 on Wasm and AIX.
I'll send a CL shortly.
cc @danscales