Repository: go
Issue: x/tools/imports: should not scan bazel-out directories
Labels: NeedsDecision,Tools

#### What did you do?

Open our monolith repository in VS Code, then open a go file and wait.

#### What did you expect to see?

Nothing.

#### What did you see instead?

The CPU usage goes up periodically due to gopls.

#### Build info

```
golang.org/x/tools/gopls 0.2.0
    golang.org/x/tools/gopls@v0.2.1 h1:qXHEqJw4CqROYvoDXinY1ZOkyAFS+jcPOvLRK76dvwY=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191108194844-46f05828f2fe h1:FNzasIzfY1IIdyTs/+o3Qv1b7YdffPbBXyjZ5VJJdIA=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
```

#### Go info

```
go version go1.13.3 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xiaoyi/Library/Caches/go-build"
GOENV="/Users/xiaoyi/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/xiaoyi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cb/j3f4sj8j3yq46t5kqcc5mpj80000gn/T/go-build258309595=/tmp/go-build -gno-record-gcc-switches -fno-common"
```

#### VSCode settings

```
  "go.formatTool": "goimports",
  "go.useLanguageServer": true,
  "go.languageServerFlags": [
    "-rpc.trace",
    "serve",
    "--debug=localhost:6060",
  ],
```

#### Relevant logs

```
[Trace - 00:49:10.532 AM] Sending notification '$/cancelRequest'.
Params: {"id":7}


2019/12/01 00:49:24 gopathwalk: scanned /Users/xiaoyi/Projects/depot in 14.658742489s
2019/12/01 00:49:24 gopathwalk: scanning /Users/xiaoyi/go/pkg/mod
2019/12/01 00:49:24 Directory added to ignore list: /Users/xiaoyi/go/pkg/mod/cache
2019/12/01 00:49:25 gopathwalk: scanned /Users/xiaoyi/go/pkg/mod in 448.168315ms
[Trace - 00:49:27.343 AM] Received response 'textDocument/codeAction - (7)' in 17316ms.
Result: {}


2019/12/01 00:49:27 : context canceled
Params: {"type":3,"message":"2019/12/01 00:56:29 done loading package names for 10 packages"}


2019/12/01 00:56:29 gopathwalk: scanning /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src
[Info  - 12:56:29 AM] 2019/12/01 00:56:29 done loading package names for 10 packages
2019/12/01 00:56:29 gopathwalk: scanned /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src in 2.097875ms
2019/12/01 00:56:29 gopathwalk: scanning /Users/xiaoyi/Projects/depot
[Trace - 00:56:30.166 AM] Sending notification '$/cancelRequest'.
Params: {"type":3,"message":"2019/12/01 00:58:00 loading package names for 10 packages"}


2019/12/01 00:58:00 gopathwalk: scanning /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src
[Info  - 12:58:00 AM] 2019/12/01 00:58:00 fixImports(filename="/Users/xiaoyi/Projects/depot/ecnova/tools/rebem/compgen/parser.go"), abs="/Users/xiaoyi/Projects/depot/ecnova/tools/rebem/compgen/parser.go", srcDir="/Users/xiaoyi/Projects/depot/ecnova/tools/rebem/compgen" ...
[Trace - 00:58:00.913 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/12/01 00:58:00 done loading package names for 10 packages"}


[Info  - 12:58:00 AM] 2019/12/01 00:58:00 loading package names for 10 packages
[Info  - 12:58:00 AM] 2019/12/01 00:58:00 done loading package names for 10 packages
2019/12/01 00:58:00 gopathwalk: scanned /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src in 3.525719ms
2019/12/01 00:58:00 gopathwalk: scanning /Users/xiaoyi/Projects/depot
[Trace - 00:58:01.083 AM] Sending request 'textDocument/foldingRange - (22)'.
Params: {"textDocument":{"uri":"file:///Users/xiaoyi/Projects/depot/ecnova/tools/rebem/compgen/parser.go"}}




2019/12/01 00:58:17 gopathwalk: scanned /Users/xiaoyi/Projects/depot in 16.553269931s
2019/12/01 00:58:17 gopathwalk: scanning /Users/xiaoyi/go/pkg/mod
2019/12/01 00:58:17 Directory added to ignore list: /Users/xiaoyi/go/pkg/mod/cache
2019/12/01 00:58:17 gopathwalk: scanned /Users/xiaoyi/go/pkg/mod in 21.910985ms
[Trace - 00:58:17.518 AM] Received response 'textDocument/codeAction - (21)' in 16609ms.
Result: {}


2019/12/01 00:58:17 gopathwalk: scanning /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src
[Info  - 12:58:17 AM] 2019/12/01 00:58:17 done loading package names for 10 packages
2019/12/01 00:58:17 gopathwalk: scanned /Users/xiaoyi/homebrew/Cellar/go/1.13.3/libexec/src in 25.22796ms
2019/12/01 00:58:17 gopathwalk: scanning /Users/xiaoyi/Projects/depot
2019/12/01 00:58:32 gopathwalk: scanned /Users/xiaoyi/Projects/depot in 15.012563751s
2019/12/01 00:58:32 gopathwalk: scanning /Users/xiaoyi/go/pkg/mod
2019/12/01 00:58:32 Directory added to ignore list: /Users/xiaoyi/go/pkg/mod/cache
2019/12/01 00:58:32 gopathwalk: scanned /Users/xiaoyi/go/pkg/mod in 19.820343ms
[Trace - 00:58:33.510 AM] Received response 'textDocument/codeAction - (23)' in 32367ms.
Result: {}
```

#### More Info

By inspecting the file opened by `gopls`, it's scanning bazel-out.