Updated Readme.md for serving multiple services (#2067)

Previous version had issues - if one service did not start for any reason, you would never know about it.
This commit is contained in:
bullgare 2019-09-23 18:48:10 +03:00 committed by Bo-Yi Wu
parent 0b96dd8ae5
commit f45c83c70c
1 changed files with 10 additions and 2 deletions

View File

@ -1678,11 +1678,19 @@ func main() {
}
g.Go(func() error {
return server01.ListenAndServe()
err := server01.ListenAndServe()
if err != nil && err != http.ErrServerClosed {
log.Fatal(err)
}
return err
})
g.Go(func() error {
return server02.ListenAndServe()
err := server02.ListenAndServe()
if err != nil && err != http.ErrServerClosed {
log.Fatal(err)
}
return err
})
if err := g.Wait(); err != nil {