Home / Companies / Cloudflare / Blog / Post Details
Content Deep Dive

Go coverage with external tests

Blog post from Cloudflare

Post Details
Company
Date Published
Author
Filippo Valsorda
Word Count
357
Company Posts That Month
7
Language
English
Hacker News Points
9
Post removed?
No
Summary

The Go test coverage implementation is innovative as it allows setting a bit in a coverage bitmap when each code portion is executed. However, there's no straightforward way to obtain coverage data for tests run against the main version of a program. A workaround involves creating a dummy test that executes main(), compiling a binary with go test -c -cover and running only that test instead of the regular binary. This method has been used in RRDNS, a custom Go DNS server. To collect coverage information, run the test battery as usual and use gocovmerge to merge coverage profiles for unit tests.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.