|
1 | 1 | # `gopls` design documentation
|
2 | 2 |
|
| 3 | +## _A note from the future_ |
| 4 | + |
| 5 | +What follows below is the original design document for gopls, aggregated from |
| 6 | +various sources spanning 2018 and 2019. Since then, all of the features listed |
| 7 | +below have been implemented, along with many others. The first two goals have |
| 8 | +been achieved: gopls is a full implementation of the LSP, and the default |
| 9 | +backend for VS Code Go and many other editors. The third goal has only been |
| 10 | +partially realized: while gopls has gained many features, it is not extensible |
| 11 | +in the sense used in this document: the only way to extend gopls is to modify |
| 12 | +gopls. The fourth goal is not achieved: while some notable companies are able |
| 13 | +to use gopls with Bazel, the experience is subpar, and the Go command is the |
| 14 | +only officially supported build system. |
| 15 | + |
| 16 | +On the other hand, two of the explicit non-goals have been reconsidered. One is |
| 17 | +minor: syntax highlighting is now supported in the LSP by way of semantic |
| 18 | +tokens. The other is major: as gopls gained popularity, it became apparent that |
| 19 | +its memory footprint was a problem. The size of developer workspaces was |
| 20 | +increasing faster than the RAM available in typically development environments |
| 21 | +(particularly with containerized development). Gopls now uses a hybrid of |
| 22 | +on-disk indexes and in-memory caches, described in more detail in our |
| 23 | +[blog post on scalability](https://go.dev/blog/gopls-scalability). |
| 24 | + |
| 25 | +Notably, in anticipating difficulties this doc turned out to be prescient. |
| 26 | +Gopls has indeed struggled against the core standary library packages upon |
| 27 | +which it is built, and its user experience is still limited by the LSP. |
| 28 | +Nevertheless, sticking with the standard library and LSP was the right |
| 29 | +approach, as despite our small team these decisions have helped gopls keep up |
| 30 | +with the evolving Go language (i.e. generics), and to integrate with many new |
| 31 | +text editors. |
| 32 | + |
| 33 | +Gopls development continues, more than four years later, with a focus on |
| 34 | +simplicity, reliability, and extensibility. The new, opt-in |
| 35 | +[Go telemetry](https://github.com/golang/tools/releases/tag/gopls%2Fv0.14.0) |
| 36 | +will help us attain a higher standard of stability in our releases than we've |
| 37 | +been able to achieve through Github issues alone. Furthermore, telemetry will |
| 38 | +allow us to focus on high-priority features, and deprecate historical |
| 39 | +workarounds that burden the codebase. With greater velocity, we look forward |
| 40 | +to working with the community on improved refactoring, static analysis, and |
| 41 | +whatever else the future brings. |
| 42 | + |
| 43 | +- _Rob Findley ( [email protected]), 2023 _ |
| 44 | + |
3 | 45 | ## Goals
|
4 | 46 |
|
5 | 47 | * `gopls` should **become the default editor backend** for the major editors used by Go programmers, fully supported by the Go team.
|
|
0 commit comments