Skip to main content
Back to Extensions Directory
coc-golang icon

coc-golang

xiyaowong

Rich Go Development for coc.nvim

Installation CommandVim prompt
:CocInstall coc-golang
GitHub owner
xiyaowong
Version
v0.9.0
npm package
coc-golang
Requirements
coc >=0.0.82
License
MIT
Repository
GitHub
npm latest published 2026-10-23Node >=22.18.0Registry summary

Published Package Summary

coc-golang logo

Logo concept by @xiyaowong, drawn with AI

coc-golang

Go language support for coc.nvim, powered by the official gopls language server and Go tools.

Install · Features · Commands · Configuration · Development

🧭 Overview

coc-golang brings Go development features to Vim and Neovim through coc.nvim. It uses gopls for language intelligence and provides commands for testing, building, formatting, linting, vulnerability checks, and common Go project tasks.

🤖 AI-assisted

To be upfront: this project is vibe-coded, and most of the code is AI-generated.

What it is not is AI slop. Every feature goes through repeated rounds of tweaking and is tested by hand before it lands — nothing is merged straight from a model's output. The direction follows vscode-go, with some features designed by me, and the polish took real effort. If vibe coding puts you off, this extension is not for you.

📦 Installation

📋 Requirements

  • Vim or Neovim with coc.nvim 0.0.82 or newer
  • Node.js 22.18 or newer
  • Go

Install the extension from Vim or Neovim:

:CocInstall coc-golang

Open a Go file to activate the extension. If gopls is not installed, coc-golang prompts you to install it. You can also install it at any time with:

:CocCommand go.gopls.install

✨ Features

  • 🧠 Language intelligence: completion, hover, signature help, diagnostics, navigation, references, rename, code actions, and document symbols through gopls.
  • 🧹 Formatting and imports: format Go code and add or organize imports.
  • 🏗️ Build and checks: build, run, vet, lint, and scan packages or workspaces for known vulnerabilities.
  • 🔎 Diagnostics: errors and warnings from gopls and from build, vet, and lint runs, each carrying the analyzer or check code, a link to its documentation, and the range the tool pointed at.
  • 🧪 Tests and benchmarks: run tests at package, workspace, file, or cursor scope; browse and run them from a tree view with pass/fail status; repeat the previous run; collect coverage and show each block's execution count; and run benchmarks.
  • 📁 Project workflows: manage modules and workspaces, install Go tools, generate code or tests, edit struct tags, and generate interface implementations.
  • 🔍 Package search: search pkg.go.dev and get, install, or download what you find without leaving the editor.
  • 🔄 Converters: generate Go types from a JSON Schema or from JSON.
  • 🌱 Go environment: inspect Go settings and configure environments for gopls, Go commands, and installed tools.

gopls handles language features. The commands below run either in a coc.nvim terminal named Go (go run, go test, benchmarks, go doc, go get, go install, go mod init) or in the Go output channel (everything else).

🚧 Development

Install dependencies, then build and type-check:

npm install
npm run build
npm run typecheck

The build writes the extension bundles to lib/.

📝 Changelog

See CHANGELOG.md.

🎯 Scope

Not included:

  • The VS Code test explorer's run/debug gutter and status-bar widgets.
  • The Delve debug adapter UI.
  • Survey and telemetry.

Update checks cover gopls only. Coverage highlighting is simpler than vscode-go's: covered and uncovered line ranges, with no gutter icons or per-block style settings.

🤖 For AI agents

If you are an AI agent working on this repository, read and follow AGENTS.md in the repository root. It is the source of truth for the project's conventions, and it overrides any default behavior.

Read the complete README
  • Rich Go Development for coc.nvim
Activation Events
  • workspaceContains:go.mod
  • workspaceContains:go.work
  • workspaceContains:main.go
  • onLanguage:go
  • onLanguage:gomod
  • onLanguage:gowork
  • onCommand:go.test.package
  • onCommand:go.test.file
  • onCommand:go.test.cursor
  • onCommand:go.test.coverage
  • onCommand:go.build.package
  • onCommand:go.vet.package
  • onCommand:go.fmt.package
  • onCommand:go.import.organize
  • onCommand:go.run
  • onCommand:go.env
  • onCommand:go.tools.install
  • onCommand:go.gopls.install
  • onCommand:go.languageserver.restart
  • onCommand:go.mod.init
Developer Resources

Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.

Open Developer Guide

Version History

Published with coc-golang@0.9.0 as CHANGELOG.md.

Open source file

Changelog

0.9.0 (2026-10-14)

Features

  • search pkg.go.dev for packages and act on the results (#94) (db32446)

0.8.0 (2026-10-14)

Features

  • highlight code coverage from go.test.coverage (#55) (2cf387c)
  • open a coverage profile with go.show.coverprofile (#63) (1ff7db4), closes #62
  • parse build, vet and lint output as structured data (#77) (18718e6)
  • pick a recorded coverage profile in go.apply.coverprofile (#58) (7b76edc), closes #57
  • pre-fill the impl receiver from the nearest struct (#91) (0c03d87)
  • show coverage counts by default (#83) (bba0264)
  • show coverage execution counts as virtual text (#75) (1e16876), closes #68
  • show long-running command state in the status bar (#85) (cf34363)
  • show the changelog with go.showChangeLog (#64) (89139f7), closes #61
  • suppress diagnostics the language server already reports (#78) (3a5d4de)

Bug Fixes

  • pass the impl receiver as one argument and insert its stubs (#88) (61a5ad1)
  • widen build and vet diagnostics to cover the reported line (#76) (0f1aae7)

Performance Improvements

  • activate from the workspace instead of every command (#70) (80b05c1), closes #65

0.7.1 (2026-10-10)

Bug Fixes

  • docs: stop the changelog page from failing hydration (#47) (bef3054)

0.7.0 (2026-10-10)

Features

0.6.0 (2026-10-09)

Features

  • docs: add a changelog page to the documentation site (#39) (fe9d733)

Bug Fixes

  • pass go-jsonschema an absolute path it can resolve on Windows (#37) (d274b69)

0.5.0 (2026-10-09)

Features

  • add go.convert.jsonSchema and surface command failures (#36) (15137a4)
  • docs: add a documentation website (#35) (200f0fa)
  • show verbose go command results as notifications (5f9cd1a)

Bug Fixes

  • guard coc.nvim host APIs in command inputs and settings writes (#34) (598c376)
  • keep gopls overlays in sync for every command (5b0988f)

0.4.0 (2026-10-09)

Features

  • show the gopls status in the status bar (655884b)

0.3.0 (2026-10-08)

Features

  • add go mod and go work commands (9684c59)
  • add go.tags commands for struct tags (73d1810)
  • add gopls settings to the configuration schema (3e2c055)

Bug Fixes

  • read unsaved state from the buffer modified option (8af8982)

0.2.0 (2026-10-08)

Features

  • improve Go commands and extension testing (7f441ca)