{"id":13438720,"url":"https://github.com/sourcegraph/go-langserver","last_synced_at":"2026-01-14T19:39:40.238Z","repository":{"id":47552387,"uuid":"70617656","full_name":"sourcegraph/go-langserver","owner":"sourcegraph","description":"Go language server to add Go support to editors and other tools that use the Language Server Protocol (LSP)","archived":true,"fork":false,"pushed_at":"2022-07-25T21:04:15.000Z","size":5314,"stargazers_count":1163,"open_issues_count":60,"forks_count":90,"subscribers_count":88,"default_branch":"master","last_synced_at":"2025-10-20T07:42:51.676Z","etag":null,"topics":["1a89010d36","repo-type-codeintel"],"latest_commit_sha":null,"homepage":"https://sourcegraph.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourcegraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-11T17:20:56.000Z","updated_at":"2025-10-04T17:37:55.000Z","dependencies_parsed_at":"2022-09-10T14:11:35.101Z","dependency_job_id":null,"html_url":"https://github.com/sourcegraph/go-langserver","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sourcegraph/go-langserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-langserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-langserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-langserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-langserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcegraph","download_url":"https://codeload.github.com/sourcegraph/go-langserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcegraph%2Fgo-langserver/sbom","scorecard":{"id":839338,"data":{"date":"2025-08-11","repo":{"name":"github.com/sourcegraph/go-langserver","commit":"fb15621e340880953c9e8e03af68a817c365f079"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lsif.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":3,"reason":"Found 10/26 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lsif.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/sourcegraph/go-langserver/lsif.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:15","Warn: goCommand not pinned by hash: brew/generate.sh:32","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   2 out of   3 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 19 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"14 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0322 / GHSA-cg3q-j54f-5p7p","Warn: Project is vulnerable to: GO-2022-0236 / GHSA-h86h-8ppg-mxmh","Warn: Project is vulnerable to: GO-2021-0238 / GHSA-83g2-8m93-v3w7","Warn: Project is vulnerable to: GO-2022-0288","Warn: Project is vulnerable to: GO-2022-0969 / GHSA-69cg-p879-7622","Warn: Project is vulnerable to: GO-2022-1144 / GHSA-xrjj-mj9h-534m","Warn: Project is vulnerable to: GO-2023-1571 / GHSA-vvpx-j8f3-3w6h","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T20:03:05.047Z","repository_id":47552387,"created_at":"2025-08-23T20:03:05.047Z","updated_at":"2025-08-23T20:03:05.047Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1a89010d36","repo-type-codeintel"],"created_at":"2024-07-31T03:01:07.859Z","updated_at":"2026-01-14T19:39:40.217Z","avatar_url":"https://github.com/sourcegraph.png","language":"Go","funding_links":[],"categories":["Misc","HarmonyOS","Go"],"sub_categories":["Windows Manager"],"readme":"# Go Language Server [![Build Status](https://travis-ci.org/sourcegraph/go-langserver.svg)](https://travis-ci.org/sourcegraph/go-langserver)\n\n\u003e *Note:* We have deprioritized work on this language server for use in\n\u003e editors in favor of Google's Go language server,\n\u003e [gopls](https://github.com/golang/tools/tree/master/gopls). It is in the best\n\u003e interests of the community to only have a single language server.\n\ngo-langserver is a [Go](https://golang.org) language server that\nspeaks\n[Language Server Protocol](https://github.com/Microsoft/language-server-protocol). It\nsupports editor features such as go-to-definition, hover, and find-references\nfor Go projects.\n\n[**Open in Sourcegraph**](https://sourcegraph.com/github.com/sourcegraph/go-langserver/-/tree/langserver)\n\nTo build and install the standalone `go-langserver` run\n\n```\ngo get -u github.com/sourcegraph/go-langserver\n```\n\n# Support\n\n|    | Hover | Jump to def | Find references | Workspace symbols | VFS extension | Isolated | Parallel |\n|----|-------|-------------|-----------------|-------------------|---------------|----------|----------|\n| Go |   ✔   |      ✔      |        ✔        |         ✔         |       ✔       |     ✔    |     ✔    |\n\n## InitializationOptions\n\nIf you are a client wanting to integrate go-langserver, you can use the following as `initializationOptions` in your [initialize](https://microsoft.github.io/language-server-protocol/specification#initialize) request to adjust the behaviour:\n\n```typescript\ninterface GoInitializationOptions {\n  /**\n   * funcSnippetEnabled enables the returning of argument snippets\n   * on `func` completions, eg. func(foo string, arg2 bar).\n   * Requires code completion to be enabled.\n   *\n   * Defaults to true if not specified.\n   */\n  funcSnippetEnabled?: boolean;\n\n  /**\n   * gocodeCompletionEnabled enables code completion feature (using gocode).\n   *\n   * Defaults to false if not specified.\n   */\n  gocodeCompletionEnabled?: boolean;\n\n  /**\n   * formatTool decides which tool is used to format documents. Supported: goimports and gofmt.\n   *\n   * Defaults to goimports if not specified.\n   */\n  formatTool?: \"goimports\" | \"gofmt\";\n\n\n  /**\n   * lintTool decides which tool is used for linting documents. Supported: none and golint\n   *\n   * Diagnostics must be enabled for linting to work.\n   *\n   * Defaults to none if not specified.\n   */\n  lintTool?: \"none\" | \"golint\";\n\n  /**\n   * goimportsLocalPrefix sets the local prefix (comma-separated string) that goimports will use.\n   *\n   * Defaults to empty string if not specified.\n   */\n  goimportsLocalPrefix?: string;\n\n  /**\n   * MaxParallelism controls the maximum number of goroutines that should be used\n   * to fulfill requests. This is useful in editor environments where users do\n   * not want results ASAP, but rather just semi quickly without eating all of\n   * their CPU.\n   *\n   * Defaults to half of your CPU cores if not specified.\n   */\n  maxParallelism?: number;\n\n  /**\n   * useBinaryPkgCache controls whether or not $GOPATH/pkg binary .a files should\n   * be used.\n   *\n   * Defaults to true if not specified.\n   */\n  useBinaryPkgCache?: boolean;\n\n  /**\n   * DiagnosticsEnabled enables handling of diagnostics.\n   *\n   * Defaults to false if not specified.\n   */\n  diagnosticsEnabled?: boolean;\n}\n```\n\n## Debugging Go code intelligence\n\nAdditional configuration for Go code intelligence may be required in some cases:\n\n- [Custom GOPATHs / Go monorepos](#custom-gopaths--go-monorepos)\n- [Vanity import paths](#vanity-import-paths)\n\n### Custom GOPATHs / Go monorepos\n\nBy default, Sourcegraph assumes that Go code in a repository represents Go packages that would be placed under `$GOPATH/src/...`. That\nis, a Go repository is assumed to only contain Go packages.\n\nFor some repositories, such as Go monorepos, this may not be the case. These repositories typically have an entire (or multiple) `$GOPA\nTH` directories comitted to them, and the Go language server may not be able to provide code intelligence without being informed of thi\ns.\n\nTo inform Sourcegraph's Go language server that your repository contains an entire `$GOPATH` directory, you can use one of three option\ns:\n\n1.  **Auto-detection via `.vscode/settings.json`**\n\n    Sourcegraph will automatically detect a Visual Studio Code `settings.json` file with a GOPATH configuration. You may already have o\nne of these files if you are using Visual Studio Code with the Go extension. The file `.vscode/settings.json` would look like:\n\n    ```json\n    {\n      \"go.gopath\": \"${workspaceRoot}/YOUR_GOPATH\"\n    }\n    ```\n\n    In this case, Sourcegraph would look for a folder named `YOUR_GOPATH` in the root of the repository.\n\n2.  **Auto-detection via `.envrc`**\n\n    Sourcegraph will also automatically detect a GOPATH from an `.envrc` file in the root of the repository. You may already have one of these if you are using direnv. For example a file such as:\n\n    ```bash\n    export GOPATH=${PWD}/third_party\n    GOPATH_add code:code2\n    GOPATH_add /absolute\n    ```\n\n    Would lead to Sourcegraph using a final `GOPATH` of `third_party:code:code2`. Note that we will ignore any `/absolute` path, and that we do not execute `.envrc` files but rather scan them for simple syntax such as the above. If you use a more complex `.envrc` file to build your `GOPATH`, this auto-detection may not work for you.\n\n3.  **Manual configuration via `.sourcegraph/config.json`**\n\n    If you add a `.sourcegraph/config.json` file in the root directory of your repository, Sourcegraph will use this configuration to determine the `GOPATH` instead of the auto-detection methods described above. An example configuration is:\n\n    ```json\n    {\n      \"go\": {\n        \"GOPATH\": [\"/third_party\", \"code\"]\n      }\n    }\n    ```\n\n    Sourcegraph will use a final `GOPATH` of `third_party:code`. That is, it will assume the `third_party` and `code` directories in the root of the repository are to be used as `$GOPATH` directories.\n\n### Vanity import paths\n\nWhen the Go language server encounters a vanity import path, it must be able to locate the source code for it or else code intelligence will not work for code related to that dependency.\n\nFor example, consider a repository `github.com/example/server` which contains Go code with an `import \"example.io/pkg/logger\"` statement.\n\n1.  If the source code for `example.io/pkg/logger` is located under a vendor directory, Sourcegraph will use that in the same manner that the `go` tool would.\n2.  If the source code for `example.io/pkg/logger` is inside of the current repository at e.g. `github.com/example/pkg/logger`, Sourcegraph will look for it by scanning the repository for a [canonical import path comment](https://golang.org/doc/go1.4#canonicalimports) using some heuristics.\n\n    - For example, if Sourcegraph finds a canonical import path comment such as `package logger // import \"example.io/pkg/logger\"` in the `pkg/logger` directory of the repository, Sourcegraph will assume that the code in the `pkg/logger` directory is what should be used when a `import \"example.io/pkg/logger\"` statement is seen.\n    - Note that Sourcegraph only needs to find one such comment for the `example.io` domain in order to resolve all other vanity imports. That is, placing this comment in `pkg/logger/logger.go` is enough for Sourcegraph to know how to import any package under `example.io/...`.\n    - Sometimes the Go language server's heuristics are not able to locate a canonical import path comment in a repository, in which case you can specify the root import path of your repository directly by placing a `.sourcegraph/config.json` file in the root of your repository, e.g.:\n\n    ```json\n    {\n      \"go\": {\n        \"RootImportPath\": \"example.io/pkg\"\n      }\n    }\n    ```\n\n    Which would tell the Go language server to clone `github.com/example/pkg` into `$GOPATH/src/example.io/pkg`.\n\n3.  Otherwise, Sourcegraph will attempt to fetch `example.io/pkg/logger` via the network using `go get example.io/pkg/logger`.\n\n## Profiling\n\nIf you run into performance issues while using the language server, it can be very helpful to attach a CPU or memory profile with the issue report. To capture one, first [install Go](https://golang.org/doc/install), start `go-langserver` with the pprof flag (e.g. `$GOPATH/bin/go-langserver -pprof :6060`) and then:\n\nCapture a heap (memory) profile:\n\n```bash\ngo tool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/heap \u003e heap.svg\n```\n\nCapture a CPU profile:\n\n```bash\ngo tool pprof -svg $GOPATH/bin/go-langserver http://localhost:6060/debug/pprof/profile \u003e cpu.svg\n```\n\nSince these capture the active resource usage, it's best to run these commands while the issue is occurring (i.e. while memory or CPU is high).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcegraph%2Fgo-langserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcegraph%2Fgo-langserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcegraph%2Fgo-langserver/lists"}