Use errors.Is instead of string comparison

This commit is contained in:
Tulir Asokan 2022-12-12 14:10:56 +02:00
commit d39599f8fb

View file

@ -44,7 +44,7 @@ func (as *AppService) Start() {
} else {
err = as.server.ListenAndServeTLS(as.Host.TLSCert, as.Host.TLSKey)
}
if err != nil && err.Error() != "http: Server closed" {
if err != nil && !errors.Is(err, http.ErrServerClosed) {
as.Log.Fatalln("Error while listening:", err)
} else {
as.Log.Debugln("Listener stopped.")