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.
- ✅ File-level coverage: shown above the
packageline. - ✅ Function-level coverage: shown above each
funcdeclaration. - ✅ Parses
coverage.outgenerated bygo test -coverpkg=./... -coverprofile=coverage.out. - ✅ Updates automatically when
coverage.outis saved or opened. - ✅ Supports both unit and integration tests.
👉 Install from Visual Studio Marketplace
- Open VS Code.
- Go to Extensions (Ctrl+Shift+X) and search for Goverage.
- Click Install.
-
Clone this repository and build the extension:
npm install npm run compile
-
Package it:
vsce package
-
Install the
.vsixfile in VS Code:code --install-extension goverage-vscode-0.1.0.vsix
-
Generate the coverage report:
go test -coverpkg=./... -coverprofile=coverage.out -
Open any
.gofile in your project. -
You’ll see inline hints like:
File Coverage: 91.75% Function Coverage: 85.00%
- Coverage uses Go’s
coverprofileformat. - Calculations are based on statements covered, not lines.
- The extension reads the
go.modfile to resolve the module name for path matching. - Monorepo support assumes
coverage.outandgo testare run per-module. - Integration tests may not mark functions as covered unless directly invoked.