|author||Rob Findley <firstname.lastname@example.org>||Sat Oct 10 09:04:36 2020 -0400|
|committer||Robert Findley <email@example.com>||Fri Oct 30 19:58:30 2020 +0000|
internal/lsp/cache: introduce a workspace abstraction When incorporating the gopls.mod file, the invalidation logic for workspace module information becomes quite complicated. For example: + if a modfile changes we should only invalidate if it is in the set of active modules + the set of active modules can be provided by either the filesystem or gopls.mod + if gopls.mod changes, we may gain or lose active modules in the workspace + if gopls.mod is *deleted*, we may need to walk the filesystem to actually find all active modules Doing this with only concrete changes to the snapshot proved prohibitively complex (at least for me), so a new workspace type is introduced to manage the module state. This new abstraction is responsible for tracking the set of active modules, the workspace modfile, and the set of workspace directories. Its invalidation logic is factored out of snapshot.clone, so that it can be tested and to alleviate some of the growing complexity of snapshot.clone. The workspace type is idempotent, allowing it to be shared across snapshots without needing to use the cache. There is little benefit to the cache in this case, since workspace module computation should be infrequent, and the type itself consumes little memory. This is made possible because the workspace type itself depends only on file state, and therefore may be invalidated independently of the snapshot. The new source.FileState interface is used in testing, and so that the workspace module may be computed based on both the session file state as well as the snapshot file state. As a result of this change, the following improvements in functionality are possible: + in the presence of a gopls.mod file, we avoid walking the filesystem to detect modules. This could be helpful for working in large monorepos or in GOPATH, when discovering all modules would be expensive. + The set of active modules should always be consistent with the gopls.mod file, likely fixing some bugs (for example, computing diagnostics for modfiles that shouldn't be loaded) For golang/go#41837 Change-Id: I2da888c097748b659ee892ca2d6b3fbe29c1942e Reviewed-on: https://go-review.googlesource.com/c/tools/+/261237 Run-TryBot: Robert Findley <firstname.lastname@example.org> gopls-CI: kokoro <email@example.com> TryBot-Result: Go Bot <firstname.lastname@example.org> Reviewed-by: Heschi Kreinick <email@example.com> Trust: Robert Findley <firstname.lastname@example.org>
This subrepository holds the source for various packages and tools that support the Go programming language.
Some of the tools,
vet for example, are included in binary Go distributions.
Others, including the Go
guru and the test coverage tool, can be fetched with
Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs.
The easiest way to install is to run
go get -u golang.org/x/tools/.... You can also manually git clone the repository to
This repository uses prettier to format JS and CSS files.
The version of
prettier used is 1.18.2.
It is encouraged that all JS and CSS code be run through this before submitting a change. However, it is not a strict requirement enforced by CI.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/tools/(your subdir):” in the subject line, so it is easy to find.