You have to use defer and recover in your `main` function if you are not
specifically handling the individual error
```
// recover must always be used in defer call
// because when panic occurs , all defer functions are called before
function returns
// https://blog.golang.org/defer-panic-and-recover
defer func() {
r := recover()
if r == nil {
return
}
//err = errors.Errorf("panic: %s", r)
// call your function again here
}()
```
On Monday, May 28, 2018, Seven Dang <[email protected]> wrote:
> Help me..!
>
> ex:
>
> trap1.go
> trap2.go
> main.go
>
> -----> run file : go run trap1.go , go run trap2.go
>
> When running, the internet connection is down or the data connection is
> down. I want the files that are corrupt to automatically run again.
>
> The best way to write a command for main.go is to run the file again
>
> trên window và linux
>
>
> Thank you ;)
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Rohit Jain
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.