Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>GoCoverageSpectatorNew to Visual Studio Code? Get it now.
GoCoverageSpectator

GoCoverageSpectator

xiaomager

|
105 installs
| (1) | Free
A simple extension to view Go coverage results on source code by specifying the coverage file.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

README


GoCoverSpectator Extension for Visual Studio Code

Display coverage results of integration tests for your Go code in Visual Studio Code. Simply generate coverage data files in txt format and apply them to your source code. If you have modified the source code, you can also make a modified line information file to mark the modified lines in the editor. So you can easily find the modified and uncovered lines of the source code.

Coverage Results

After loading the modified line information file, the lines of the modified files will be marked with a yellow border. The file explorer will indicate files with modified and uncovered lines using a warning icon when the modified information is available. Navigate to the previous/next modified and uncovered line by typing the next/previous button in the editor context menu. Modified and Uncovered Lines

The format of the modified line information file is as follows:

relative/path/to/root/module/file1.go:startline1,endline1
relative/path/to/root/module/file1.go:startline2,endline2
......
relative/path/to/root/module/pkg1/file2.go:startline1,endline1
relative/path/to/root/module/pkg2/file2.go:startline2,endline2

example:

staticgo/main.go:12,12
staticgo/main.go:15,18
staticgo/main.go:26,26
staticgo/main.go:34,36

Usage

First, convert the coverage profile file to txt format as follows:

go tool covdata textfmt -i=somedata -o profile.txt

Then,choose the coverage file by pressing Ctrl+Shift+P and typing GoCoverageSpectator:Select Coverage File.After the file is loaded, the coverage results will be displayed in the editor.

You can clear the coverage results by pressing Ctrl+Shift+P and typing GoCoverageSpectator:Clear Coverage Results.

You can load the modified line information file by pressing Ctrl+Shift+P and typing GoCoverageSpectator:Load Modified Line Information File.After the file is loaded, the modified lines will be marked in the editor.

You can clear the modified line information by pressing Ctrl+Shift+P and typing GoCoverageSpectator:Clear Modified Line Information.

After loading the coverage file and modified line information file, you can navigate to the previous/next modified and uncovered line by typing the next/previous button in the editor context menu.The files with modified and uncovered lines will be marked with a warning icon in the file explorer.

Cautions

  1. Please ensure that the source code matches the coverage file; otherwise, the coverage results may be incorrect.

  2. Please ensure that the opened project is located in the same directory as the root go.mod.

Known Issues

The coverage mode is currently limited to set mode.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft