﻿# V8007\. Calling the 'recover' function inside the anonymous function that is not deferred will not recover execution from panic\.

The analyzer has detected the use of the recover function within an anonymous function that is called immediately\. So, if a panic occurs, the goroutine cannot resume execution\.

Look at the synthetic example:

```cpp
func foo() {
  func() {
    if r := recover(); r != nil {
      fmt.Println("Recovered", r)
    }
  }()
  q, r := bits.Div64(hi, lo, y)
  ....
}
```

After the code defines the anonymous function and calls it, the `bits.Div64` function is called\. This function can trigger a panic if `y` equals `0`\. If that panic reaches the top of the stack, the program will crash\.

Call `[recover](https://go.dev/ref/spec#Handling_panics)` after the panic occurs to restore execution\. In the current code, the `recover` function runs before any possible panic because it is defined within an immediately\-called anonymous function\. As a result, nothing gets recovered\.

You can fix this by deferring the anonymous function via the `defer` keyword:

```cpp
func foo() {
  defer func() {
    if r := recover(); r != nil {
      fmt.Println("Recovered", r)
    }
  }()
  q, r := bits.Div64(hi, lo, y)
}
```