https://github.com/itsubaki/unrecoverable-panic
Unrecoverable panic in Go
https://github.com/itsubaki/unrecoverable-panic
panic
Last synced: 11 months ago
JSON representation
Unrecoverable panic in Go
- Host: GitHub
- URL: https://github.com/itsubaki/unrecoverable-panic
- Owner: itsubaki
- License: mit
- Created: 2023-05-10T12:07:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-22T04:30:29.000Z (almost 3 years ago)
- Last Synced: 2025-02-07T06:15:05.317Z (about 1 year ago)
- Topics: panic
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unrecoverable-panic
```go
package main
func main() {
defer func() {
if err := recover(); err != nil {
println("unreachable: %v", err)
}
}()
f()
println("unreachable")
}
func f() {
go panic("something went wrong")
select {}
}
```
```shell
$ go run main.go
panic: something went wrong
goroutine 17 [running]:
main.f.func1()
/workspaces/unrecoverable-panic/main.go:16 +0x2a
created by main.f
/workspaces/unrecoverable-panic/main.go:16 +0x4a
exit status 2
$
```
## Links
* https://zenn.dev/matsuyoshi/articles/a492d339d21317
* https://github.com/golang/sync/blob/a6666c150eb9762365996ad2f3a8c35b0818d7bb/singleflight/singleflight.go#L158