use log.Fatal() instead of panic() in example client and server

This commit is contained in:
Marten Seemann 2020-01-08 15:15:52 +07:00
parent 59c2c34dbc
commit 2ba4617463
2 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ import (
"crypto/x509"
"flag"
"io"
"log"
"net/http"
"sync"
@ -32,7 +33,7 @@ func main() {
pool, err := x509.SystemCertPool()
if err != nil {
panic(err)
log.Fatal(err)
}
testdata.AddRootCA(pool)
roundTripper := &http3.RoundTripper{
@ -53,14 +54,14 @@ func main() {
go func(addr string) {
rsp, err := hclient.Get(addr)
if err != nil {
panic(err)
log.Fatal(err)
}
logger.Infof("Got response for %s: %#v", addr, rsp)
body := &bytes.Buffer{}
_, err = io.Copy(body, rsp.Body)
if err != nil {
panic(err)
log.Fatal(err)
}
if *quiet {
logger.Infof("Request Body: %d bytes", body.Len())