tools/go/packages
Douglas Danger Manley 4e3518700c go/packages: stop parsing files if the context is canceled
`stamblerre/gocode`, which is the fork of `mdempsky/gocode` that supports Go 1.11 modules, uses `packages.Load` to load all of the Go code for, among other things, IDE autocomplete support.  A common aspect to IDE autocomplete is asking for suggestions very frequently (perhaps at every character typed).  Once the user has typed another character, the previous request for autocomplete is invalid and can be canceled.

`packages.Load` already stops its `go list` component if the context is canceled, but if the context is canceled afterward, then it will parse all of the files that it found.  This change stops the parsing of Go files once it detects that the context has been canceled.  When a file has not been processed due to cancelation, its error will be set to that of the context.

This change dramatically improves the performance of the `stamblerre/gocode` fork when requests have been canceled.

Change-Id: Iba8c1e08eefa59137559ac9108238bfe5ba4ac21
GitHub-Last-Rev: 11a2210c8ce2ed9db9462ddc3e9676476f49f937
GitHub-Pull-Request: golang/tools#72
Reviewed-on: https://go-review.googlesource.com/c/159259
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-24 20:56:45 +00:00
..
gopackages go/package/gopackages: update gopackages to use the new tool library for its main function 2019-01-08 19:17:02 +00:00
packagestest imports: stop using go/packages for modules 2019-01-22 20:29:12 +00:00
testdata go/packages: add name= query 2018-10-16 20:20:09 +00:00
doc.go Remove warning stability warning 2019-01-08 19:38:35 +00:00
example_test.go go/packages: remove the Config.Error hook 2018-09-04 20:52:37 +00:00
external.go go/packages: use packagesdriver to fetch sizes for "go list" 2018-12-19 20:36:29 +00:00
golist.go imports: stop using go/packages for modules 2019-01-22 20:29:12 +00:00
golist_fallback.go go/packages: make tests pass with custom GOCACHE 2019-01-16 20:24:37 +00:00
golist_fallback_testmain.go go/packages: add missing test variants to fallback loader 2018-09-25 16:56:39 +00:00
golist_overlay.go go/packages: check for containing files after overlay is processed 2018-12-06 19:48:17 +00:00
packages.go go/packages: stop parsing files if the context is canceled 2019-01-24 20:56:45 +00:00
packages110_test.go go/packages: generate test main files from the golist fallback 2018-09-17 22:19:12 +00:00
packages_test.go go/packages: make tests pass with custom GOCACHE 2019-01-16 20:24:37 +00:00
packagescgo_test.go go/...: use recommended issue tracker URLs 2018-12-05 01:41:16 +00:00
stdlib_test.go go/...: use recommended issue tracker URLs 2018-12-05 01:41:16 +00:00
visit.go go/packages: make visit order stable 2018-11-02 02:37:01 +00:00