From 0e53d2555e9a6ddc707f6c59497f30e182116c80 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 10 Apr 2019 20:30:34 +0200 Subject: force a version of golang.org/x/tools due to an incompatibility with gqlgen --- .../golang.org/x/tools/internal/fastwalk/fastwalk_unix.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go') diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go index 67db6caf..3369b1a0 100644 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go +++ b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go @@ -8,7 +8,6 @@ package fastwalk import ( - "bytes" "fmt" "os" "syscall" @@ -32,6 +31,7 @@ func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) e buf := make([]byte, blockSize) // stack-allocated; doesn't escape bufp := 0 // starting read position in buf nbuf := 0 // end valid data in buf + skipFiles := false for { if bufp >= nbuf { bufp = 0 @@ -62,7 +62,14 @@ func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) e } typ = fi.Mode() & os.ModeType } + if skipFiles && typ.IsRegular() { + continue + } if err := fn(dirName, name, typ); err != nil { + if err == SkipFiles { + skipFiles = true + continue + } return err } } @@ -106,10 +113,7 @@ func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { } nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := bytes.IndexByte(nameBuf[:], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } + nameLen := direntNamlen(dirent) // Special cases for common things: if nameLen == 1 && nameBuf[0] == '.' { -- cgit