Hello Gophers,
I have wrote some encryption and decryption code recently and find out
in cbcDecrypter , and cbcEncrypter provided by runtime, it panic instead
of return error, thus I need to used defer to recover from the panic , if
it ever happens
The question is why it is implement in t
func listenAndServe(ctx context.Context, srv *http.Server, errCh chan<-
error) {
err := srv.ListenAndServe()
select {
case errCh <- err:
case <-ctx.Done():
}
}
ListenAndServe is blocking function, so the select will not happen until
ListenAndServe return. and errCh become no use
On Wednes
That's kind of expected behavior , "*1. A deferred function's arguments are
evaluated when the defer statement is evaluated." *
refer to https://blog.golang.org/defer-panic-and-recover
On Wednesday, March 29, 2017 at 9:48:52 AM UTC+11, Stefan Engstrom wrote:
>
> Playing with recovery from a panic
Hi David,
I saw similar solutions using DNS to add / remove node from cluster,
the client side spin up a go routine keep resolving the DNS in an
interval, if it find new ip appears in DNS record, add it to the pool ,
when ip address disappear from the DNS, it removes from the pool.