From 46ad450327111b9d28b592658d75ef57da498298 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Wed, 15 Feb 2023 16:44:29 -0700 Subject: Switch Handler to an interface. HandlerFunc is much better as a function returning a Handler, rather than a newtype for the function type itself. This way there is no confusion creating a type-inferenced variable with HandlerFunc(func(... and then using a HandlerFunc where a Handler is expected. Much better to only have one public type. --- contrib/cgi/gemini.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/cgi/gemini.go') diff --git a/contrib/cgi/gemini.go b/contrib/cgi/gemini.go index 8302e7e..1587037 100644 --- a/contrib/cgi/gemini.go +++ b/contrib/cgi/gemini.go @@ -17,7 +17,7 @@ import ( // the URI path. func GeminiCGIDirectory(pathRoot, fsRoot string) gus.Handler { fsRoot = strings.TrimRight(fsRoot, "/") - return func(ctx context.Context, request *gus.Request) *gus.Response { + return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { if !strings.HasPrefix(request.Path, pathRoot) { return nil } @@ -43,5 +43,5 @@ func GeminiCGIDirectory(pathRoot, fsRoot string) gus.Handler { return gemini.Failure(err) } return response - } + }) } -- cgit v1.2.3