pkg/assets: remove DumpingWalker exported function
FLUO component was the last user of it and it is not used anymore, so it
can be removed.
@@ -17,7 +17,6 @@ package assets
import (
"fmt"
"io"
- "io/ioutil"
"os"
"path/filepath"
)
@@ -39,39 +38,6 @@ func copyingWalker(path string, newDirPerms os.FileMode) WalkFunc {
}
}
-// DumpingWalker returns a WalkFunc which sets the contents of the given file in a map.
-func DumpingWalker(contentsMap map[string]string, allowedExts ...string) WalkFunc {
- var extsMap map[string]struct{}
-
- if len(allowedExts) > 0 {
- extsMap = make(map[string]struct{}, len(allowedExts))
- for _, ext := range allowedExts {
- extsMap[ext] = struct{}{}
- }
- }
-
- return func(fileName string, fileInfo os.FileInfo, r io.ReadSeeker, err error) error {
- if err != nil {
- return fmt.Errorf("error while walking at %q: %w", fileName, err)
- }
-
- if extsMap != nil {
- if _, ok := extsMap[filepath.Ext(fileName)]; !ok {
- return nil
- }
- }
-
- contents, err := ioutil.ReadAll(r)
- if err != nil {
- return fmt.Errorf("failed to read %q: %w", fileName, err)
- }
-
- contentsMap[fileName] = string(contents)
-
- return nil
- }
-}
-
// writeFile writes data from given io.Reader to the file and makes sure, that
// this is the only content stored in the file.
func writeFile(p string, r io.Reader) error {
