Created
October 7, 2013 21:38
-
-
Save elazarl/6875394 to your computer and use it in GitHub Desktop.
possible bug in Go's code generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bug | |
type returnPanic struct { | |
err error | |
} | |
func F() (err error) { | |
defer func() { | |
if _, ok := recover().(returnPanic); !ok { | |
panic(err) | |
} | |
}() | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bug | |
import ( | |
"fmt" | |
"testing" | |
) | |
func TestBasicHadoopConf(t *testing.T) { | |
fmt.Println("1") | |
F() | |
// this never happens, maybe parent defer is inlined here? | |
panic("hoho") | |
} | |
/* | |
~/D/bug ❯❯❯ go test | |
1 | |
PASS | |
ok _/home/elazar/Dropbox/bug 0.005s | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment