{"id":13479054,"url":"https://github.com/josa42/coc-go","last_synced_at":"2025-04-12T20:39:01.933Z","repository":{"id":40981910,"uuid":"183397996","full_name":"josa42/coc-go","owner":"josa42","description":"Go language server extension using gopls for coc.nvim.","archived":false,"fork":false,"pushed_at":"2024-10-22T00:30:54.000Z","size":1364,"stargazers_count":573,"open_issues_count":13,"forks_count":30,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T19:07:52.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/josa42.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-25T09:08:04.000Z","updated_at":"2025-03-31T05:57:55.000Z","dependencies_parsed_at":"2023-09-28T04:46:55.557Z","dependency_job_id":"b0b0ccd3-6926-4863-b268-868ecd4015c2","html_url":"https://github.com/josa42/coc-go","commit_stats":{"total_commits":334,"total_committers":23,"mean_commits":"14.521739130434783","dds":"0.20958083832335328","last_synced_commit":"1158aca48eb603a6540fc2e60c51f4a2642a97f8"},"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josa42%2Fcoc-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josa42%2Fcoc-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josa42%2Fcoc-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josa42%2Fcoc-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josa42","download_url":"https://codeload.github.com/josa42/coc-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631668,"owners_count":21136554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-31T16:02:08.419Z","updated_at":"2025-04-12T20:39:01.876Z","avatar_url":"https://github.com/josa42.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Editor Plugins","Language Support","编辑器插件","Libraries for creating HTTP middlewares"],"sub_categories":["Routers","路由器"],"readme":"# coc-go\n\nGo language server extension using [`gopls`](https://github.com/golang/go/wiki/gopls)\nfor [`coc.nvim`](https://github.com/neoclide/coc.nvim).\n\n## Install\n\nIn your vim/neovim, run this command:\n\n```\n:CocInstall coc-go\n```\n\n## Features\n\nSee [`gopls`](https://github.com/golang/tools/blob/master/gopls/README.md)\n\n## Commands\n\nAdditional to commands provided by gopls, this extensions provides these commands:\n\n| Key                             | Description                                        |\n|---------------------------------|----------------------------------------------------|\n| **`go.gopls.tidy`**             | Run gopls.tidy LSP command                         |\n| **`go.impl.cursor`**            | Generate interface stubs                           |\n| **`go.install.gomodifytags`**   | Install / update gomodifytags                      |\n| **`go.install.goplay`**         | Install / update goplay                            |\n| **`go.install.gopls`**          | Install / update gopls                             |\n| **`go.install.gotests`**        | Install / update gotests                           |\n| **`go.install.impl`**           | Install / update impl                              |\n| **`go.install.tools`**          | Install / update all tools                         |\n| **`go.playground`**             | Run on go playground                               |\n| **`go.tags.add`**               | Add tags to struct fields                          |\n| **`go.tags.add.line`**          | Add tags to struct field in current line           |\n| **`go.tags.add.prompt`**        | Add tags to struct fields (prompt)                 |\n| **`go.tags.clear`**             | Remove all tags from struct fields                 |\n| **`go.tags.clear.line`**        | Remove all tags from struct fields in current line |\n| **`go.tags.remove`**            | Remove tags from struct fields                     |\n| **`go.tags.remove.line`**       | Remove tags from struct field in current line      |\n| **`go.tags.remove.prompt`**     | Remove tags from struct fields (prompt)            |\n| **`go.test.generate.exported`** | Generate unit tests for exported functions in file |\n| **`go.test.generate.file`**     | Generate unit tests for file                       |\n| **`go.test.generate.function`** | Generate unit tests for current function           |\n| **`go.test.toggle`**            | Toggle test file                                   |\n| **`go.version`**                | Print extension version                            |\n\n### Examples\n\n- **Add or Remove specific tags**\n\n  ```\n  CocCommand go.tags.add yaml\n  CocCommand go.tags.add yaml json xml\n  CocCommand go.tags.remove xml\n  ```\n\n- **Add missing imports on save**\n\n  ```viml\n  autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')\n  ```\n\n- **Map Keys to command**\n\n  ```viml\n  autocmd FileType go nmap gtj :CocCommand go.tags.add json\u003ccr\u003e\n  autocmd FileType go nmap gty :CocCommand go.tags.add yaml\u003ccr\u003e\n  autocmd FileType go nmap gtx :CocCommand go.tags.clear\u003ccr\u003e\n  ```\n\n## Snippets\n\nSnippets are imported from [`golang/vscode-go`](https://github.com/microsoft/vscode-go)\nand require [`coc-snippets`](https://github.com/neoclide/coc-snippets) to be\ninstalled.\n\n## Configuration options\n\n| Key                                | Description                                                                                                                                                                                                                   | Default           |\n|------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|\n| **`go.checkForUpdates`**           | Check for gopls updates on start.                                                                                                                                                                                             | install           |\n| **`go.disable`**                   | Disable gopls features                                                                                                                                                                                                        | {}                |\n| ‣ `completion`                     | Disable completion feature (Change requires `:CocRestart`)                                                                                                                                                                    | false             |\n| ‣ `diagnostics`                    | Disable handle diagnostics (Change requires `:CocRestart`)                                                                                                                                                                    | false             |\n| ‣ `features`                       | Disabled features (Change requires `:CocRestart`)                                                                                                                                                                             | []                |\n| ‣ `snippetCompletion`              | Disable snippet completion (Change requires `:CocRestart`)                                                                                                                                                                    | false             |\n| ‣ `workspaceFolders`               | Disable workspaceFolders feature (Change requires `:CocRestart`)                                                                                                                                                              | false             |\n| **`go.enable`**                    | Enable Go extension                                                                                                                                                                                                           | true              |\n| **`go.goplsArgs`**                 | Arguments passed to `gopls` (Change requires `:CocRestart`)                                                                                                                                                                   |                   |\n| **`go.goplsEnv`**                  | ENV passed to `gopls` (Change requires `:CocRestart`)                                                                                                                                                                         |                   |\n| **`go.goplsOptions`**              | See [`gopls` documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md )                                                                                                                               |                   |\n| ‣ `allowImplicitNetworkAccess`     | **This setting is experimental and may be deleted.**  allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module downloads rather than requiring user action.                                                  | false             |\n| ‣ `analyses`                       | analyses specify analyses that the user would like to enable or disable.                                                                                                                                                      |                   |\n| ‣ `analysisProgressReporting`      | analysisProgressReporting controls whether gopls sends progress notifications when construction of its index of analysis facts is taking a long time.                                                                         | true              |\n| ‣ `annotations`                    | **This setting is experimental and may be deleted.**  annotations specifies the various kinds of optimization diagnostics that should be reported by the gc_details command.                                                  |                   |\n| ‣ `buildFlags`                     | buildFlags is the set of flags passed on to the build system when invoked.                                                                                                                                                    |                   |\n| ‣ `codelenses`                     | codelenses overrides the enabled/disabled state of each of gopls' sources of [Code Lenses](codelenses.md).                                                                                                                    |                   |\n| ‣ `completeFunctionCalls`          | completeFunctionCalls enables function call completion.                                                                                                                                                                       | true              |\n| ‣ `completionBudget`               | **This setting is for debugging purposes only.**  completionBudget is the soft latency goal for completion requests.                                                                                                          | 100ms             |\n| ‣ `diagnosticsDelay`               | **This is an advanced setting and should not be configured by most `gopls` users.**  diagnosticsDelay controls the amount of time that gopls waits after the most recent file modification before computing deep diagnostics. | 1s                |\n| ‣ `diagnosticsTrigger`             | **This setting is experimental and may be deleted.**  diagnosticsTrigger controls when to run diagnostics.                                                                                                                    | Edit              |\n| ‣ `directoryFilters`               | directoryFilters can be used to exclude unwanted directories from the workspace.                                                                                                                                              |                   |\n| ‣ `env`                            | env adds environment variables to external commands run by `gopls`, most notably `go list`.                                                                                                                                   |                   |\n| ‣ `expandWorkspaceToModule`        | **This setting is experimental and may be deleted.**  expandWorkspaceToModule determines which packages are considered \"workspace packages\" when the workspace is using modules.                                              | true              |\n| ‣ `experimentalPostfixCompletions` | **This setting is experimental and may be deleted.**  experimentalPostfixCompletions enables artificial method snippets such as \"someSlice.sort!\".                                                                            | true              |\n| ‣ `gofumpt`                        | gofumpt indicates if we should run gofumpt formatting.                                                                                                                                                                        | false             |\n| ‣ `hints`                          | **This setting is experimental and may be deleted.**  hints specify inlay hints that users want to see.                                                                                                                       |                   |\n| ‣ `hoverKind`                      | hoverKind controls the information that appears in the hover text.                                                                                                                                                            | FullDocumentation |\n| ‣ `importShortcut`                 | importShortcut specifies whether import statements should link to documentation or go to definitions.                                                                                                                         | Both              |\n| ‣ `linkTarget`                     | linkTarget is the base URL for links to Go package documentation returned by LSP operations such as Hover and DocumentLinks and in the CodeDescription field of each Diagnostic.                                              | pkg.go.dev        |\n| ‣ `linksInHover`                   | linksInHover controls the presence of documentation links in hover markdown.                                                                                                                                                  | true              |\n| ‣ `local`                          | local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after third-party packages.                                                                                             |                   |\n| ‣ `matcher`                        | **This is an advanced setting and should not be configured by most `gopls` users.**  matcher sets the algorithm that is used when calculating completion candidates.                                                          | Fuzzy             |\n| ‣ `memoryMode`                     | **This setting is experimental and may be deleted.**  obsolete, no effect                                                                                                                                                     |                   |\n| ‣ `noSemanticNumber`               | **This setting is experimental and may be deleted.**  noSemanticNumber  turns off the sending of the semantic token 'number'                                                                                                  | false             |\n| ‣ `noSemanticString`               | **This setting is experimental and may be deleted.**  noSemanticString turns off the sending of the semantic token 'string'                                                                                                   | false             |\n| ‣ `semanticTokens`                 | **This setting is experimental and may be deleted.**  semanticTokens controls whether the LSP server will send semantic tokens to the client.                                                                                 | false             |\n| ‣ `standaloneTags`                 | standaloneTags specifies a set of build constraints that identify individual Go source files that make up the entire main package of an executable.                                                                           |                   |\n| ‣ `staticcheck`                    | **This setting is experimental and may be deleted.**  staticcheck enables additional analyses from staticcheck.io.                                                                                                            | false             |\n| ‣ `symbolMatcher`                  | **This is an advanced setting and should not be configured by most `gopls` users.**  symbolMatcher sets the algorithm that is used when finding workspace symbols.                                                            | FastFuzzy         |\n| ‣ `symbolScope`                    | symbolScope controls which packages are searched for workspace/symbol requests.                                                                                                                                               | all               |\n| ‣ `symbolStyle`                    | **This is an advanced setting and should not be configured by most `gopls` users.**  symbolStyle controls how symbols are qualified in symbol responses.                                                                      | Dynamic           |\n| ‣ `templateExtensions`             | templateExtensions gives the extensions of file names that are treated as template files.                                                                                                                                     |                   |\n| ‣ `usePlaceholders`                | placeholders enables placeholders for function parameters or struct fields in completion responses.                                                                                                                           | false             |\n| ‣ `verboseOutput`                  | **This setting is for debugging purposes only.**  verboseOutput enables additional debug logging.                                                                                                                             | false             |\n| ‣ `vulncheck`                      | **This setting is experimental and may be deleted.**  vulncheck enables vulnerability scanning.                                                                                                                               | Off               |\n| **`go.goplsPath`**                 | Path to `gopls` bin (Change requires `:CocRestart`)                                                                                                                                                                           |                   |\n| **`go.goplsUseDaemon`**            | Run gopls as daemon                                                                                                                                                                                                           | true              |\n| **`go.tags`**                      |                                                                                                                                                                                                                               |                   |\n| ‣ `options`                        | Comma separated tag=options pairs to be used by `go.tags.add` command                                                                                                                                                         | json=omitempty    |\n| ‣ `skipUnexported`                 | If true, skip unexported fields                                                                                                                                                                                               | false             |\n| ‣ `tags`                           | Comma separated tags to be used by `go.tags.add` command                                                                                                                                                                      | json              |\n| ‣ `transform`                      | Transformation rule used by `go.tags.add` command to add tags                                                                                                                                                                 | snakecase         |\n| **`go.tests`**                     |                                                                                                                                                                                                                               |                   |\n| ‣ `generateFlags`                  | Additional command line flags to pass to `gotests` for generating tests.                                                                                                                                                      | []                |\n| **`go.trace.server`**              | Trace level of gopls                                                                                                                                                                                                          | off               |\n\nTrigger completion in `coc-settings.json` to get complete list.\n\n### Example Configuration\n\n```json\n{\n  \"go.goplsOptions\": {\n    \"completeUnimported\": true\n  }\n}\n```\n\n## Development\n\n1. Run `npm run build` or `npm run build:watch`\n2. Link extension: `npm run link` / `npm run unlink`\n\n## Tools\n\n- [`gomodifytags`](http://github.com/fatih/gomodifytags) - [BSD](https://github.com/fatih/gomodifytags/blob/master/LICENSE)\n- [`goplay`](http://github.com/haya14busa/goplay) - [MIT](https://github.com/haya14busa/goplay/blob/master/LICENSE)\n- [`gopls`](https://golang.org/x/tools/cmd/gopls)\n- [`gotests`](http://github.com/cweill/gotests) - [Apache](https://github.com/cweill/gotests/blob/develop/LICENSE)\n- [`impl`](https://github.com/josharian/impl) - [MIT](https://github.com/josharian/impl/blob/master/LICENSE.txt)\n\n## FAQ\n\n### How does `coc-go` compare to `vim-go`?\n\nWith `coc-go` I do not aim to recreate the features of `vim-go`. For now, the\nmain goal is to provide a convenient way to install `gopls` and use it with\n`coc.nvim`.\n\nIf you need more than the features provided by `gopls`, you are probably better\nof with [`vim-go`](https://github.com/fatih/vim-go) or\n[`govim`](https://github.com/govim/govim).\n\n### How to use `coc-go` with wasm?\n\nAdd this to you (local) `coc-settings.json` (run `:CocLocalConfig`).\n\n```json\n{\n  \"go.goplsEnv\": {\n    \"GOOS\": \"js\",\n    \"GOARCH\": \"wasm\",\n  }\n}\n```\n\n### Running `gopls` as a daemon\n\n`coc-go` runs `gopls` as shared daemon by passing `-remote=auto` to `gopls`. To\ndisable this behavior set `go.goplsUseDaemon` to `false`.\n\nSee [Running gopls as a daemon](https://github.com/golang/tools/blob/master/gopls/doc/daemon.md) for more information.\n\n## License\n\n[MIT © Josa Gesell](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosa42%2Fcoc-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosa42%2Fcoc-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosa42%2Fcoc-go/lists"}