From f715d28cea22de3a5752bdf019c1a00d4dcadf63 Mon Sep 17 00:00:00 2001
From: Than McIntosh -pgo=off
turns off profile-guided optimization.
+ The go
build
, go
install
,
+ and other build-related commands now support a -cover
+ flag that builds the specified target with code coverage instrumentation.
+ This is described in more detail in the
+ Cover section below.
+
go
version
@@ -228,7 +236,19 @@ Do not send CLs removing the interior tags from such phrases.
- TODO coverage + Go 1.20 supports collecting code coverage profiles for programs + (applications and integration tests), as opposed to just unit tests. +
+ +
+ To collect coverage data for a program, build it with go
+ build
's -cover
flag, then run the resulting
+ binary with the environment variable GOCOVERDIR
set
+ to an output directory for coverage profiles.
+ See the
+ 'coverage for integration tests' landing page for more on how to get started.
+ For details on the design and implementation, see the
+ proposal.
+ Go 1.20 adds a new runtime/coverage
package
+ containing APIs for writing coverage profile data at
+ runtime from a long-running and/or server programs that
+ do not terminate via os.Exit()
.
+