Skip to content

Goverage is a plugin for VS Code that shows inline test coverage percentages for each function, powered by go tool cover.

License

Notifications You must be signed in to change notification settings

pixel365/goverage-vscode

Repository files navigation

Goverage – Inline Go Code Coverage Hints for VS Code

Goverage is a VS Code extension that displays inline code coverage hints for Go files, based on the go test -coverprofile report.
It helps visualize how well your Go functions and files are covered by tests.


✨ Features

  • File-level coverage: shown above the package line.
  • Function-level coverage: shown above each func declaration.
  • ✅ Parses coverage.out generated by go test -coverpkg=./... -coverprofile=coverage.out.
  • ✅ Updates automatically when coverage.out is saved or opened.
  • ✅ Supports both unit and integration tests.

📦 Installation

✅ From VS Code Marketplace

👉 Install from Visual Studio Marketplace

  1. Open VS Code.
  2. Go to Extensions (Ctrl+Shift+X) and search for Goverage.
  3. Click Install.

🛠 Manual Installation

  1. Clone this repository and build the extension:

    npm install
    npm run compile
  2. Package it:

    vsce package
  3. Install the .vsix file in VS Code:

    code --install-extension goverage-vscode-0.1.0.vsix
    

🚀 Usage

  1. Generate the coverage report:

    go test -coverpkg=./... -coverprofile=coverage.out
  2. Open any .go file in your project.

  3. You’ll see inline hints like:

    File Coverage: 91.75%
    Function Coverage: 85.00%
    

🛠️ Notes

  • Coverage uses Go’s coverprofile format.
  • Calculations are based on statements covered, not lines.
  • The extension reads the go.mod file to resolve the module name for path matching.
  • Monorepo support assumes coverage.out and go test are run per-module.
  • Integration tests may not mark functions as covered unless directly invoked.

📄 License

MIT

About

Goverage is a plugin for VS Code that shows inline test coverage percentages for each function, powered by go tool cover.

Resources

License

Stars

Watchers

Forks

Packages

No packages published