mirror of
https://github.com/golang/go
synced 2024-11-18 10:14:45 -07:00
gopathwalk: don't log for nonexistant root dirs
If users don't have a module cache yet, or put a nonexistant directory in their GOPATH, it doesn't make sense to print an error. Just ignore it and move on. No tests; I don't think it makes sense to set up log scraping for this. Change-Id: I90719297ade37999e8b401767a0a37c940828c27 Reviewed-on: https://go-review.googlesource.com/c/142977 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
parent
e94054f410
commit
654e6e76cd
@ -63,6 +63,12 @@ func Walk(roots []Root, add func(root Root, dir string), opts Options) {
|
||||
}
|
||||
|
||||
func walkDir(root Root, add func(Root, string), opts Options) {
|
||||
if _, err := os.Stat(root.Path); os.IsNotExist(err) {
|
||||
if opts.Debug {
|
||||
log.Printf("skipping nonexistant directory: %v", root.Path)
|
||||
}
|
||||
return
|
||||
}
|
||||
if opts.Debug {
|
||||
log.Printf("scanning %s", root.Path)
|
||||
}
|
||||
@ -73,11 +79,11 @@ func walkDir(root Root, add func(Root, string), opts Options) {
|
||||
}
|
||||
w.init()
|
||||
if err := fastwalk.Walk(root.Path, w.walk); err != nil {
|
||||
log.Printf("goimports: scanning directory %v: %v", root.Path, err)
|
||||
log.Printf("gopathwalk: scanning directory %v: %v", root.Path, err)
|
||||
}
|
||||
|
||||
if opts.Debug {
|
||||
defer log.Printf("scanned %s", root.Path)
|
||||
log.Printf("scanned %s", root.Path)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user