From 2fd98cb040b617d2a018ae00a3a68b320de7dbc6 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 21 May 2019 14:22:21 -0600 Subject: Module.New() does not need to return an error --- modules/caddyhttp/caddyhttp.go | 2 +- modules/caddyhttp/caddylog/log.go | 2 +- modules/caddyhttp/fileserver/matcher.go | 2 +- modules/caddyhttp/fileserver/staticfiles.go | 2 +- modules/caddyhttp/headers/headers.go | 2 +- modules/caddyhttp/matchers.go | 18 +++++++++--------- modules/caddyhttp/reverseproxy/module.go | 2 +- modules/caddyhttp/rewrite/rewrite.go | 2 +- modules/caddyhttp/staticresp.go | 2 +- modules/caddyhttp/table.go | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) (limited to 'modules/caddyhttp') diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index e5b9f61..09a130e 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -22,7 +22,7 @@ func init() { err := caddy2.RegisterModule(caddy2.Module{ Name: "http", - New: func() (interface{}, error) { return new(App), nil }, + New: func() interface{} { return new(App) }, }) if err != nil { diff --git a/modules/caddyhttp/caddylog/log.go b/modules/caddyhttp/caddylog/log.go index d3110cc..f39fd87 100644 --- a/modules/caddyhttp/caddylog/log.go +++ b/modules/caddyhttp/caddylog/log.go @@ -12,7 +12,7 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.middleware.log", - New: func() (interface{}, error) { return new(Log), nil }, + New: func() interface{} { return new(Log) }, }) } diff --git a/modules/caddyhttp/fileserver/matcher.go b/modules/caddyhttp/fileserver/matcher.go index 29805a2..8196131 100644 --- a/modules/caddyhttp/fileserver/matcher.go +++ b/modules/caddyhttp/fileserver/matcher.go @@ -11,7 +11,7 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.file", - New: func() (interface{}, error) { return new(FileMatcher), nil }, + New: func() interface{} { return new(FileMatcher) }, }) } diff --git a/modules/caddyhttp/fileserver/staticfiles.go b/modules/caddyhttp/fileserver/staticfiles.go index 19f5f68..c6a01ac 100644 --- a/modules/caddyhttp/fileserver/staticfiles.go +++ b/modules/caddyhttp/fileserver/staticfiles.go @@ -21,7 +21,7 @@ func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.responders.file_server", - New: func() (interface{}, error) { return new(FileServer), nil }, + New: func() interface{} { return new(FileServer) }, }) } diff --git a/modules/caddyhttp/headers/headers.go b/modules/caddyhttp/headers/headers.go index b56bbf9..e94fb54 100644 --- a/modules/caddyhttp/headers/headers.go +++ b/modules/caddyhttp/headers/headers.go @@ -11,7 +11,7 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.middleware.headers", - New: func() (interface{}, error) { return new(Headers), nil }, + New: func() interface{} { return new(Headers) }, }) } diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 13e122a..64a9312 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -32,39 +32,39 @@ type ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.host", - New: func() (interface{}, error) { return matchHost{}, nil }, + New: func() interface{} { return matchHost{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.path", - New: func() (interface{}, error) { return matchPath{}, nil }, + New: func() interface{} { return matchPath{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.path_regexp", - New: func() (interface{}, error) { return new(matchPathRE), nil }, + New: func() interface{} { return new(matchPathRE) }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.method", - New: func() (interface{}, error) { return matchMethod{}, nil }, + New: func() interface{} { return matchMethod{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.query", - New: func() (interface{}, error) { return matchQuery{}, nil }, + New: func() interface{} { return matchQuery{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.header", - New: func() (interface{}, error) { return matchHeader{}, nil }, + New: func() interface{} { return matchHeader{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.header_regexp", - New: func() (interface{}, error) { return matchHeaderRE{}, nil }, + New: func() interface{} { return matchHeaderRE{} }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.protocol", - New: func() (interface{}, error) { return new(matchProtocol), nil }, + New: func() interface{} { return new(matchProtocol) }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.starlark_expr", - New: func() (interface{}, error) { return new(matchStarlarkExpr), nil }, + New: func() interface{} { return new(matchStarlarkExpr) }, }) } diff --git a/modules/caddyhttp/reverseproxy/module.go b/modules/caddyhttp/reverseproxy/module.go index 1bfc9ad..7e149d0 100755 --- a/modules/caddyhttp/reverseproxy/module.go +++ b/modules/caddyhttp/reverseproxy/module.go @@ -8,6 +8,6 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.responders.reverse_proxy", - New: func() (interface{}, error) { return new(LoadBalanced), nil }, + New: func() interface{} { return new(LoadBalanced) }, }) } diff --git a/modules/caddyhttp/rewrite/rewrite.go b/modules/caddyhttp/rewrite/rewrite.go index 9bd01c0..b7878a5 100644 --- a/modules/caddyhttp/rewrite/rewrite.go +++ b/modules/caddyhttp/rewrite/rewrite.go @@ -12,7 +12,7 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.middleware.rewrite", - New: func() (interface{}, error) { return new(Rewrite), nil }, + New: func() interface{} { return new(Rewrite) }, }) } diff --git a/modules/caddyhttp/staticresp.go b/modules/caddyhttp/staticresp.go index 47fae22..62ab7dd 100644 --- a/modules/caddyhttp/staticresp.go +++ b/modules/caddyhttp/staticresp.go @@ -11,7 +11,7 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.responders.static", - New: func() (interface{}, error) { return new(Static), nil }, + New: func() interface{} { return new(Static) }, }) } diff --git a/modules/caddyhttp/table.go b/modules/caddyhttp/table.go index 8c3ebe0..fce4267 100644 --- a/modules/caddyhttp/table.go +++ b/modules/caddyhttp/table.go @@ -9,12 +9,12 @@ import ( func init() { caddy2.RegisterModule(caddy2.Module{ Name: "http.middleware.table", - New: func() (interface{}, error) { return new(tableMiddleware), nil }, + New: func() interface{} { return new(tableMiddleware) }, }) caddy2.RegisterModule(caddy2.Module{ Name: "http.matchers.table", - New: func() (interface{}, error) { return new(tableMatcher), nil }, + New: func() interface{} { return new(tableMatcher) }, }) } -- cgit v1.2.3