...
1 package filesonly
2
3
9
10 import (
11 "net/http"
12 "os"
13 )
14
15
16
17 func FileSystem(dir string) http.FileSystem {
18 return fileSystem{http.Dir(dir)}
19 }
20
21 type fileSystem struct {
22 fs http.FileSystem
23 }
24
25 func (fs fileSystem) Open(name string) (http.File, error) {
26 f, err := fs.fs.Open(name)
27 if err != nil {
28 return nil, err
29 }
30 return file{f}, nil
31 }
32
33 type file struct {
34 http.File
35 }
36
37 func (f file) Readdir(count int) ([]os.FileInfo, error) {
38 return nil, nil
39 }
40
View as plain text