Skip to content
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

Add support for Go recovered panics #3

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

kasparjarek
Copy link

When Go panic is recovered and thrown again it duplicates the first line of panic suffixed with [recovered]. The finite automaton is currently unable to recognise this panic output.

panic: foo [recovered]
	panic: foo [recovered]
	panic: foo [recovered]
	panic: foo

goroutine 1 [running]:
main.recoverAndPanic()
	/tmp/sandbox1820875720/prog.go:12 +0x34
panic({0x459120, 0x476600})
	/usr/local/go-faketime/src/runtime/panic.go:838 +0x207
main.recoverAndPanic()
	/tmp/sandbox1820875720/prog.go:12 +0x34
panic({0x459120, 0x476600})
	/usr/local/go-faketime/src/runtime/panic.go:838 +0x207
main.recoverAndPanic()
	/tmp/sandbox1820875720/prog.go:12 +0x34
panic({0x459120, 0x476600})
	/usr/local/go-faketime/src/runtime/panic.go:838 +0x207
main.main()
	/tmp/sandbox1820875720/prog.go:7 +0x5d

The output is produced by following code:

package main

func main() {
	defer recoverAndPanic()
	defer recoverAndPanic()
	defer recoverAndPanic()
	panic("foo")
}

func recoverAndPanic() {
	if r := recover(); r != nil {
		panic(r)
	}
}

BTW I have created the same PR also for the upstream repo GoogleCloudPlatform#98

@kuldazbraslav kuldazbraslav merged commit 796613e into kuldazbraslav:master Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants