From f715d28cea22de3a5752bdf019c1a00d4dcadf63 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Wed, 30 Nov 2022 12:04:59 -0500 Subject: [PATCH] doc/go1.20: add section on coverage Add some basic material on the changes to code coverage testing to the release notes. For #54202. Change-Id: I28200d43b4952ce8e8ecf46c8fe8e97c81d245e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/453857 TryBot-Result: Gopher Robot Run-TryBot: Than McIntosh Reviewed-by: Eli Bendersky Reviewed-by: Cherry Mui --- doc/go1.20.html | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/go1.20.html b/doc/go1.20.html index f53680e3ba4..d14034c2f50 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -175,6 +175,14 @@ Do not send CLs removing the interior tags from such phrases. Specifying -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.

Cover

- 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.

Vet

@@ -285,6 +305,13 @@ Do not send CLs removing the interior tags from such phrases. assists in some circumstances.

+

+ 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(). +

+

Compiler