-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcover.md
More file actions
39 lines (29 loc) · 956 Bytes
/
Copy pathcover.md
File metadata and controls
39 lines (29 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
date: 2025-10-20 09:53
description: Coverageツール
author: Tadahiro Ishisaka
---
# Go言語のCoverageツール
## カバレッジの取得
```bash
go test ./url -coverprofile cover.out
```
## カバレッジの可視化
```bash
go tool cover -html=cover.out
```

### カバレッジの確認
```bash
go tool cover -func=cover.out
github.com/ishisaka/go_by_example/url/url.go:20: Parse 100.0%
github.com/ishisaka/go_by_example/url/url.go:40: String 100.0%
github.com/ishisaka/go_by_example/url/url.go:72: SetScheme 100.0%
total: (statements) 100.0%
```
### カバレッジのレポート出力
```bash
go tool cover -o cover.html -html=cover.out
```
## 参考情報
* [Goでテストカバレッジを測定する \#Go \- Qiita](https://qiita.com/takehanKosuke/items/4342ca544d205fb36eb0)