-
-
Save kovetskiy/675af5a87cd33a1169a3 to your computer and use it in GitHub Desktop.
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 main | |
import ( | |
"log" | |
"net/http" | |
) | |
type Handler struct{} | |
func (handler Handler) ServeHTTP( | |
response http.ResponseWriter, request *http.Request, | |
) { | |
defer func() { | |
if err := recover(); err != nil { | |
log.Printf("do not panic, please") | |
} | |
}() | |
// how to handle panic in this routine? | |
go func() { | |
var blah *Handler | |
blah.ServeHTTP(nil, nil) | |
}() | |
} | |
func main() { | |
handler := Handler{} | |
http.ListenAndServe(":9090", handler) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment