Go language support via extension
View options
- Truncate descriptions
Created by: sqs
Sourcegraph's support for Go hovers, go-to-definition, find-references, and find-implementations is built on sourcegraph/go-langserver. This has worked well so far to provide those features, but we want to be able to provide code intelligence features and configuration on par with editors, such as more Go guru features, a smoother configuration experience, and other helpful context. To do this, we are moving all language support (including Go) to being built as Sourcegraph extensions. The initial milestone is to get the current feature set ported to an extension.
Goals
- Remove Go buildserver dependency on gitserver
- Go langserver that we will be running on sourcegraph.com through extension is built from public go-langserver repo
- lsp-proxy is not necessary for code intelligence => websockets are used to communicate from extension to langserver
- No Go langserver specific code in sourcegraph/sourcegraph
- No Sourcegraph specific code in Go language server
- Maintain cross repository code intelligence
- Indexer is not necessary for this
- 3.0-preview only support dependencies that are public on GitHub
Milestones
- Add WebSockets support to go-langserver https://github.com/sourcegraph/go-langserver/pull/339
- Remove old xfiles/xcontent VFS implementation https://github.com/sourcegraph/sourcegraph/pull/941
-
Add support for fetching from a token-authed zip URL specified in
rootUri
for the current repo files (still fall back to gitserver forgit://
URIs) https://github.com/sourcegraph/sourcegraph/pull/987 - Remove usage of xcache and replace with in-memory or on-disk http cache https://github.com/sourcegraph/sourcegraph/pull/989
- Deploy and enable new extension https://sourcegraph.com/extensions/chris/lang-go to Sourcegraph.com, disable langserver/go. Keep the old langserver-http code path.
- Bump version of go-langserver in sourcegraph/sourcegraph and update the buildserver code to reduce conflicts when migrating later https://github.com/sourcegraph/sourcegraph/pull/1028
- Add TLS support to xlang-go https://github.com/sourcegraph/sourcegraph/pull/1041 (and later go-langserver https://github.com/sourcegraph/go-langserver/pull/349)
-
Deploy new
xlang-go-websockets
and add a DNS record forgo.sourcegraph.com -> <IP of load balancer for xlang-go-websockets>
. You can try out WebSockets by setting"lang-go.address": "wss://go.sourcegraph.com"
. https://github.com/sourcegraph/infrastructure/pull/693 -
Switch to the new code path by adding
lang-go.address
to global settings. At this point, the LSP gateway will only be used for cross-repo refs. - Implement cross-repo references in lang-go using search+xreferences (as specced out in the gdoc). Add another references provider that does xrefs, wait for @sqs to come up with a way to explicitly register an external references provider. This means all code intel is provided by lang-go.
- Put all lsp/lspext types in go-lsp https://github.com/sourcegraph/sourcegraph/pull/1058 and https://github.com/sourcegraph/go-lsp/pull/1
- Deploy a gddo proxy to get around CORS https://github.com/sourcegraph/infrastructure/pull/698
- Drop lsp-proxy from xlang-go tests, migrate to go-langserver https://github.com/sourcegraph/sourcegraph/pull/1060
-
Reimplement
/go/
links https://github.com/sourcegraph/sourcegraph/pull/1197 - Move the buildserver code to go-langserver https://github.com/sourcegraph/go-langserver/pull/345
- Reimplement the shield and badge endpoints https://github.com/sourcegraph/sourcegraph/pull/1377
- Support private deps https://github.com/sourcegraph/go-langserver/pull/348
- Set up deployments from go-langserver to Sourcegraph.com. At this point, xlang-go is no longer used on Sourcegraph.com https://github.com/sourcegraph/go-langserver/pull/351
- Document how to deploy (see lang-typescript) and the settings for the lang-go extension in the README then close https://github.com/sourcegraph/sourcegraph/issues/886
-
(for 3.0) Add env vars for
noGoGetDomains
andblacklist
https://github.com/sourcegraph/sourcegraph/issues/1276 - Stream external references WIP branch stream-external-refs
-
Do not evict the zip on close (see the discussion)It doesn't seem to get evicted even whenevictOnClose: true
E2E test checklist
- Vanity import paths TODO construct a test repo for this
- Public code https://sourcegraph.com/github.com/gorilla/mux/-/blob/mux.go
- Private code TODO construct a test repo for this
- Public code with private dependencies TODO construct a test repo for this
- Custom repo name
"repos.list": { "url": "https://github.com/gorilla/csrf.git", "path": "customreponame" }
- https://github.com/sourcegraph/sourcegraph/issues/139
- https://github.com/sourcegraph/sourcegraph/issues/129
- https://github.com/sourcegraph/sourcegraph/issues/145

