diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-14 02:06:41 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-14 02:06:41 +0200 |
commit | 43f808a0e263ada899acb5cc523cfcab6d07c20d (patch) | |
tree | eb019f77fb2111d7c31fc5dcd2a10fe6b7c7ceef /vendor/github.com/shurcooL/httpfs/filter/filters.go | |
parent | 5edcb6c8bd430af4c26567d19c388d4c3e30b681 (diff) | |
download | git-bug-43f808a0e263ada899acb5cc523cfcab6d07c20d.tar.gz |
webui: don't pack the huge .map file for production
Diffstat (limited to 'vendor/github.com/shurcooL/httpfs/filter/filters.go')
-rw-r--r-- | vendor/github.com/shurcooL/httpfs/filter/filters.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/shurcooL/httpfs/filter/filters.go b/vendor/github.com/shurcooL/httpfs/filter/filters.go new file mode 100644 index 00000000..a20edaf4 --- /dev/null +++ b/vendor/github.com/shurcooL/httpfs/filter/filters.go @@ -0,0 +1,26 @@ +package filter + +import ( + "os" + pathpkg "path" +) + +// FilesWithExtensions returns a filter func that selects files (but not directories) +// that have any of the given extensions. For example: +// +// filter.FilesWithExtensions(".go", ".html") +// +// Would select both .go and .html files. It would not select any directories. +func FilesWithExtensions(exts ...string) Func { + return func(path string, fi os.FileInfo) bool { + if fi.IsDir() { + return false + } + for _, ext := range exts { + if pathpkg.Ext(path) == ext { + return true + } + } + return false + } +} |