npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

coc-golang

v0.9.0

Published

Rich Go Development for coc.nvim

Readme

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.

coc.nvim Go Node.js

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).

💻 Commands

Run commands with :CocCommand, for example:

:CocCommand go.test.package

The ones you'll reach for most:

| Task | Command | | --- | --- | | Run tests in the current package | go.test.package | | Run the test at the cursor | go.test.cursor | | Run the tests in the current file | go.test.file | | Toggle coverage for the current package | go.test.coverage | | Build the current package | go.build.package | | Vet the current package | go.vet.package | | Format the current package | go.fmt.package | | Organize imports | go.import.organize | | Show the Go environment | go.env | | Install a Go tool | go.tools.install | | Search packages on pkg.go.dev | go.pkg.search |

Every go.* command — all 83, grouped by area — is in the command reference.

Some commands need an extra tool: test generation uses gotests, struct tags use gomodifytags, and interface generation uses impl. Vulnerability analysis is provided by gopls.

🔍 Package search

go.pkg.search searches pkg.go.dev for a package and acts on what it finds. Each action runs a go command:

| Action | Command | | --- | --- | | get (default) | go get <packagePath> | | install | go install <packagePath> | | download | go mod download <modulePath> |

Several packages can be picked at once.

See Package search for the details.

🌳 Test explorer

go.test.explorer.show opens a Go Tests tree view of your workspace's tests and benchmarks:

  • Nested folder → package → file → test → subtest.
  • Run any node — a file, package, or folder runs everything beneath it.
  • Pass/fail status on every node, plus a location to jump to.
  • Press f to filter the tree by name.

go.test.explorer remains as the quick-pick alternative.

See Test explorer for the details.

🔄 Converters

  • go.convert.jsonSchema Generate Go types from a JSON Schema.
  • go.convert.jsonToGo Generate Go types from JSON.

go.convert.jsonSchema runs go-jsonschema on the active JSON Schema file and opens the generated Go. Schemas that use the date or date-time formats make the generated code import github.com/atombender/go-jsonschema/pkg/types.

go.convert.jsonToGo opens a scratch JSON buffer and a scratch Go buffer side by side, regenerating the Go types as you type. The JSON can come from the clipboard, from a file, or from an empty buffer.

The generated Go matches the defaults of mholt/json-to-go and needs no extra tool.

See Converters for the details.

🔖 Struct tags

go.tags.add, go.tags.remove, and go.tags.clear run gomodifytags on the struct or field under the cursor, or on a visual selection.

🌱 Go environment and tools

Commands for the Go environment and tools:

  • go.env, go.gopath, go.goroot, go.version, go.environment.choose — inspect or select the Go environment.
  • go.locate.tools — locate installed tools.
  • go.tools.install, go.tools.install.<tool> — install tools.
  • go.gopls.install — install gopls.
  • go.languageserver.restart — restart gopls.

Optional tools are dlv, goimports, staticcheck, gomodifytags, gotests, impl, golint, golangci-lint, golangci-lint-v2, revive, gofumpt, goformat, and go-jsonschema. Delve works with external DAP clients; coc-golang provides no debug adapter UI.

🔧 Configuration

Add settings to coc-settings.json. For example:

{
  "go.useLanguageServer": true,
  "go.autoInstallGopls": true,
  "go.languageServerFlags": [],
  "go.goplsUseDaemon": true,
  "gopls": {},
  "go.buildFlags": [],
  "go.buildTags": "",
  "go.formatTool": "default",
  "go.testTimeout": "30s",
  "go.testOnSave": false,
  "go.diagnostic.vulncheck": "Imports"
}

Setting names, types, and defaults follow vscode-go. The gopls setting accepts gopls options, including dotted keys.

Go-specific settings such as build flags, build tags, inlay hints, vulnerability checks, and code lenses are forwarded to gopls unless explicitly set there. Vulnerability analysis uses gopls' import-based diagnostics and built-in govulncheck code lens/quick fix; go.vulncheck.toggle enables or disables the import-based diagnostics.

Some settings to know:

  • Go environment: go.goroot, go.gopath, go.toolsEnvVars, go.toolsGopath, and go.alternateTools control the environment and executable paths used by Go commands, gopls, and tool installs. Set go.terminal.activateEnvironment to export the configured environment to Neovim.
  • Formatting: go.formatTool supports gofmt, goimports, goformat, gofumpt, and custom. With go.useLanguageServer: false, the default formatter uses goimports.
  • Checks: build and vet on save run when go.useLanguageServer is false. Lint on save runs when go.lintTool is configured. Available lint tools are staticcheck, golint, golangci-lint, golangci-lint-v2, and revive; diagnostics are reported by coc.nvim.
  • Tests: go.testFlags and go.testTags fall back to go.buildFlags and go.buildTags. go.testTimeout supplies the test timeout, and go.testEnvFile is loaded before go.testEnvVars.
  • Coverage: go.test.coverage toggles coverage for the current package: it runs go test -coverprofile, then highlights covered code (CocCoverageCovered) and uncovered code (CocCoverageUncovered) in the loaded Go buffers. Running it again, or saving an edited Go file, clears the highlights. go.apply.coverprofile highlights from an existing profile: it offers the profiles of previous runs, or takes a path of your own. go.show.coverprofile opens a profile — one of those runs, or a path of your own — in a buffer. go.coverMode sets -covermode, and go.coverShowCounts appends each covered block's execution count as virtual text.
  • Language server: set go.useLanguageServer to false to disable gopls and use Go commands and formatters directly.

🚧 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.