From 5ec8dea1ba1ba41cb6b0c231a6cdeb761949ab06 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Sun, 14 Feb 2021 19:27:56 -0500 Subject: [PATCH] fs: Update documentation --- fs.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs.go b/fs.go index 56d1432..d282edc 100644 --- a/fs.go +++ b/fs.go @@ -14,10 +14,8 @@ func init() { } // FileServer returns a handler that serves Gemini requests with the contents -// of the file system rooted at root. +// of the provided file system. // The returned handler cleans paths before handling them. -// -// TODO: Use io/fs.FS when available. func FileServer(fsys FS) Handler { return fsHandler{fsys} } @@ -41,16 +39,12 @@ func (fsh fsHandler) ServeGemini(w ResponseWriter, r *Request) { _, _ = io.Copy(w, f) } -// FS represents a filesystem. -// -// TODO: Replace with io/fs.FS when available. +// FS represents a file system. type FS interface { Open(name string) (File, error) } // File represents a file. -// -// TODO: Replace with io/fs.File when available. type File interface { Stat() (os.FileInfo, error) Read([]byte) (int, error) @@ -58,8 +52,6 @@ type File interface { } // Dir implements FS using the native filesystem restricted to a specific directory. -// -// TODO: replace with os.DirFS when available. type Dir string // Open tries to open the file with the given name. @@ -71,8 +63,6 @@ func (d Dir) Open(name string) (File, error) { // ServeFile responds to the request with the contents of the named file // or directory. -// -// TODO: Use io/fs.FS when available. func ServeFile(w ResponseWriter, fs FS, name string) { f, err := fs.Open(name) if err != nil {