An open API service indexing awesome lists of open source software.

https://github.com/pixel365/goverage

Goverage is a JetBrains plugin for GoLand that shows inline test coverage percentages for each function, powered by go tool cover.
https://github.com/pixel365/goverage

go goland goland-plugin golang idea-plugin jetbrains jetbrains-plugin

Last synced: 6 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Goverage – Inline Go Code Coverage Hints

**Goverage** is a JetBrains IDE plugin that displays inline code coverage for Go files based on the `go test -coverprofile` report.
It supports **GoLand**, **IntelliJ IDEA Ultimate**, and any JetBrains IDE with the Go plugin.

---

## ✨ 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 the file or coverage profile changes.

---

## 📦 Installation

### ✅ From JetBrains Marketplace

👉 [Install via JetBrains Marketplace](https://plugins.jetbrains.com/plugin/27851-goverage)

1. Open your JetBrains IDE (e.g. GoLand or IntelliJ IDEA).
2. Go to **Settings → Plugins → Marketplace**.
3. Search for **Goverage**, then click **Install**.
4. Restart the IDE if prompted.

---

### 🛠 Manual Installation

1. Clone the repository and build the plugin:

```bash
./gradlew clean buildPlugin
```

2. In your JetBrains IDE:
- Go to **Settings → Plugins → ⚙️ → Install Plugin from Disk**.
- Select the `.zip` file from `build/distributions`.

---

## 🚀 Usage

1. Generate a coverage profile in the root of your Go module:

```bash
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 is resolved using the path format found in `coverage.out`, typically like:
`github.com/your/module/pkg/file.go`
- The plugin reads the `go.mod` file to determine the module name.
- Only works with monorepos if `go test` and `coverage.out` are executed per-module.
- Coverage is computed based on Go’s `coverprofile` format, which counts covered **statements**, not lines.
- Integration tests might not hit every code path, even if the file is used indirectly.
- Some files may appear with partial coverage if branches or conditions are not fully executed.

---

## 📄 License

[MIT](https://github.com/pixel365/goverage/blob/main/LICENSE)