New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go language support via extension #958

Closed
sqs opened this Issue Nov 13, 2018 · 10 comments

Comments

Projects
None yet
3 participants
@sqs
Copy link
Member

sqs commented Nov 13, 2018

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 sourcegraph/go-langserver#339
  • Remove old xfiles/xcontent VFS implementation #941
  • Add support for fetching from a token-authed zip URL specified in rootUri for the current repo files (still fall back to gitserver for git:// URIs) #987
  • Remove usage of xcache and replace with in-memory or on-disk http cache #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 #1028
  • Add TLS support to xlang-go #1041 (and later go-langserver sourcegraph/go-langserver#349)
  • Deploy new xlang-go-websockets and add a DNS record for go.sourcegraph.com -> <IP of load balancer for xlang-go-websockets>. You can try out WebSockets by setting "lang-go.address": "wss://go.sourcegraph.com". sourcegraph/infrastructure#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 #1058 and sourcegraph/go-lsp#1
  • Deploy a gddo proxy to get around CORS sourcegraph/infrastructure#698
  • Drop lsp-proxy from xlang-go tests, migrate to go-langserver #1060
  • Reimplement /go/ links #1197
  • Move the buildserver code to go-langserver sourcegraph/go-langserver#345
  • Reimplement the shield and badge endpoints #1377
  • Support private deps sourcegraph/go-langserver#348
  • Set up deployments from go-langserver to Sourcegraph.com. At this point, xlang-go is no longer used on Sourcegraph.com sourcegraph/go-langserver#351
  • Document how to deploy (see lang-typescript) and the settings for the lang-go extension in the README then close #886
  • (for 3.0) Add env vars for noGoGetDomains and blacklist #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 when evictOnClose: true

E2E test checklist

@sqs sqs added this to the 3.0-preview milestone Nov 13, 2018

@sqs sqs changed the title Go extension Go language support via extenion Nov 13, 2018

@sqs sqs changed the title Go language support via extenion Go language support via extension Nov 13, 2018

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 13, 2018

The raw API is not exposed internally on /.internal/..., and exposing it would take more effort than implementing token auth, so I'm planning to do token auth before moving code to go-langserver. (updated description).

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 14, 2018

I abandoned #943 which was intended to construct the zip URL inside of the Go buildserver in favor of #987 which adds a zipURL field to initializationOptions and makes xlang-go fetch from there if present.

I also added token generation and zipURL construction to lang-go in sourcegraph/sourcegraph-go@280de6b

lang-go uses langserver-http as a dependency to make requests to the LSP gateway (A.K.A. LSP Proxy HTTP API), and in order to pipe the zipURL through, I had to parameterize langserver-http in sourcegraph/sourcegraph-langserver-http#10 More info in the README https://github.com/sourcegraph/lang-go

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 14, 2018

Replaced xcache with an in-memory HTTP cache in xlang-go in #989

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 15, 2018

For our org on Sourcegraph.com I've disabled the synthesized langserver/go extension and enabled chris/lang-go.

@sqs sqs referenced this issue Nov 15, 2018

Closed

Go langserver+buildserver without lsp-proxy #647

2 of 5 tasks complete
@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 16, 2018

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 18, 2018

Cross repo refs work on private instances using search. It doesn't work on Sourcegraph.com because there are too many repos. I tried the godoc.org importers API, but it doesn't allow CORS.

I added more docs (usage+docker+k8s+settings) to https://github.com/sourcegraph/lang-go

Operationally speaking, the Go buildserver no longer depends on lsp-proxy , but there are some code dependencies in tests that I'll remove. I plan to move the buildserver code over to go-langserver tomorrow.

@sqs

This comment has been minimized.

Copy link
Member Author

sqs commented Nov 28, 2018

@chrismwendt When do you think you'll be ready to switch over to the Go extension on Sourcegraph.com for all users (including providing cross-repo refs via the Go extension)? Need help testing?

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Nov 28, 2018

@sqs Probably tomorrow (Thursday). All code intel except for cross-repo refs currently goes through the new lang-go extension (see global-settings):

image

I remember there was still some UI work to be done for external refs, but I could implement streaming external refs now in the plain refs sidebar (building off of #1061).

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Dec 13, 2018

All Go code intelligence on Sourcegraph.com now goes through the lang-go extension and the new lang-go docker image built from go-langserver.

@nicksnyder nicksnyder modified the milestones: 3.0-preview, 3.0 Dec 14, 2018

@chrismwendt

This comment has been minimized.

Copy link
Contributor

chrismwendt commented Dec 17, 2018

Done! New docs and extension homepage: https://github.com/sourcegraph/lang-go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment