update deps

This commit is contained in:
Andrey Nering
2017-11-19 18:26:37 -02:00
parent e065dcb816
commit 57e42af238
294 changed files with 159496 additions and 183 deletions

View File

@@ -21,8 +21,8 @@ import (
"runtime"
)
// traverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir.
var traverseLink = errors.New("traverse symlink, assuming target is a directory")
// TraverseLink is a sentinel error for fastWalk, similar to filepath.SkipDir.
var TraverseLink = errors.New("traverse symlink, assuming target is a directory")
// FastWalk walks the file tree rooted at root, calling walkFn for
// each file or directory in the tree, including root.
@@ -35,7 +35,7 @@ var traverseLink = errors.New("traverse symlink, assuming target is a directory"
// any permission bits.
// * multiple goroutines stat the filesystem concurrently. The provided
// walkFn must be safe for concurrent use.
// * fastWalk can follow symlinks if walkFn returns the traverseLink
// * fastWalk can follow symlinks if walkFn returns the TraverseLink
// sentinel error. It is the walkFn's responsibility to prevent
// fastWalk from going into symlink cycles.
func FastWalk(root string, walkFn func(path string, typ os.FileMode) error) error {
@@ -144,7 +144,7 @@ func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error {
err := w.fn(joined, typ)
if typ == os.ModeSymlink {
if err == traverseLink {
if err == TraverseLink {
// Set callbackDone so we don't call it twice for both the
// symlink-as-symlink and the symlink-as-directory later:
w.enqueue(walkItem{dir: joined, callbackDone: true})

View File

@@ -111,6 +111,14 @@ func makePattern(pattern string) (*zenv, error) {
}
func Glob(pattern string) ([]string, error) {
return glob(pattern, false)
}
func GlobFollowSymlinks(pattern string) ([]string, error) {
return glob(pattern, true)
}
func glob(pattern string, followSymlinks bool) ([]string, error) {
zenv, err := makePattern(pattern)
if err != nil {
return nil, err
@@ -131,6 +139,16 @@ func Glob(pattern string) ([]string, error) {
}
path = filepath.ToSlash(path)
if followSymlinks && info == os.ModeSymlink {
followedPath, err := filepath.EvalSymlinks(path)
if err == nil {
fi, err := os.Lstat(followedPath)
if err == nil && fi.IsDir() {
return fastwalk.TraverseLink
}
}
}
if info.IsDir() {
if path == "." || len(path) <= len(zenv.root) {
return nil

View File

@@ -568,6 +568,10 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
name = "strings"
case "intSlice":
name = "ints"
case "uintSlice":
name = "uints"
case "boolSlice":
name = "bools"
}
return