Make ResponseWriter an interface

Make ResponseWriter an interface with an unexported method. Implementors
must embed a ResponseWriter from elsewhere. This gives us the
flexibility of an interface while allowing us to add new methods in the
future.
This commit is contained in:
Adnan Maolood 2021-02-24 00:13:44 -05:00
parent 526d232ab0
commit 3660698a4b
5 changed files with 92 additions and 65 deletions

12
fs.go
View File

@ -33,7 +33,7 @@ type fileServer struct {
fs.FS fs.FS
} }
func (fs fileServer) ServeGemini(ctx context.Context, w *ResponseWriter, r *Request) { func (fs fileServer) ServeGemini(ctx context.Context, w ResponseWriter, r *Request) {
serveFile(w, r, fs, path.Clean(r.URL.Path), true) serveFile(w, r, fs, path.Clean(r.URL.Path), true)
} }