core: Don't return error on RegisterModule() and RegisterAdapter()

These functions are called at init-time, and their inputs are hard-coded
so there are no environmental or user factors that could make it fail
or succeed; the error return values are often ignored, and when they're
not, they are usually a fatal error anyway. To ensure that a programmer
mistake is not missed, we now panic instead.

Last breaking change 🤞
This commit is contained in:
Matthew Holt 2020-04-13 09:48:54 -06:00
parent 68cebb28d0
commit ec456811bb
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5
4 changed files with 16 additions and 22 deletions

View file

@ -30,10 +30,7 @@ import (
)
func init() {
err := caddy.RegisterModule(App{})
if err != nil {
caddy.Log().Fatal(err.Error())
}
caddy.RegisterModule(App{})
}
// App is a robust, production-ready HTTP server.

View file

@ -30,10 +30,7 @@ import (
func init() {
weakrand.Seed(time.Now().UnixNano())
err := caddy.RegisterModule(tlsPlaceholderWrapper{})
if err != nil {
caddy.Log().Fatal(err.Error())
}
caddy.RegisterModule(tlsPlaceholderWrapper{})
}
// RequestMatcher is a type that can match to a request.