updating github.com/spf13/afero to v1.2.2

This commit is contained in:
Davanum Srinivas
2019-06-14 11:32:53 -04:00
parent caba257fc9
commit 56612c8b2e
55 changed files with 504 additions and 4585 deletions

View File

@@ -20,7 +20,6 @@ import (
"bytes"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
@@ -46,7 +45,7 @@ func WriteReader(fs Fs, path string, r io.Reader) (err error) {
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
if err != nil {
if err != os.ErrExist {
log.Panicln(err)
return err
}
}
}
@@ -157,7 +156,7 @@ func UnicodeSanitize(s string) string {
return string(target)
}
// Transform characters with accents into plan forms
// Transform characters with accents into plain forms.
func NeuterAccents(s string) string {
t := transform.Chain(norm.NFD, transform.RemoveFunc(isMn), norm.NFC)
result, _, _ := transform.String(t, string(s))
@@ -295,10 +294,10 @@ func IsEmpty(fs Fs, path string) (bool, error) {
}
if fi.IsDir() {
f, err := fs.Open(path)
defer f.Close()
if err != nil {
return false, err
}
defer f.Close()
list, err := f.Readdir(-1)
return len(list) == 0, nil
}