mirror of
https://github.com/caddyserver/caddy.git
synced 2026-09-01 00:48:03 +00:00
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:
parent
68cebb28d0
commit
ec456811bb
4 changed files with 16 additions and 22 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue