1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:54:40 -07:00

imports: show detailed error when directory cannot be opened

Fixes golang/go#24154

Change-Id: I2834cc2578e911499cbce5412fe6a9041248794d
Reviewed-on: https://go-review.googlesource.com/97359
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Yury Smolsky 2018-02-27 18:02:18 +02:00 committed by Brad Fitzpatrick
parent 10db2d12cf
commit 73e16cff9e

View File

@ -24,7 +24,7 @@ const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDe
func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error {
fd, err := syscall.Open(dirName, 0, 0)
if err != nil {
return err
return &os.PathError{Op: "open", Path: dirName, Err: err}
}
defer syscall.Close(fd)