_content: move testing/coverage to doc/build-cover, with redirects
By default documentation should be in doc/.
There is no strong reason to keep testing in its own tree,
so move the one file here, /testing/coverage/,
to doc/build-cover, which better describes what
this is (building with coverage, as opposed to go test -cover).
Add a redirect to keep existing links working.
Change-Id: Ic3a3dfa9ae98788a0a1558bac0ce3934b1ead815
Reviewed-on: https://go-review.googlesource.com/c/website/+/548118
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/_content/testing/coverage/index.md b/_content/doc/build-cover.md
similarity index 98%
rename from _content/testing/coverage/index.md
rename to _content/doc/build-cover.md
index 7f06686..15a971b 100644
--- a/_content/testing/coverage/index.md
+++ b/_content/doc/build-cover.md
@@ -3,8 +3,6 @@
layout: article
---
-[Back to Go Testing](/testing)
-
Table of Contents:
[Overview](#overview)\
@@ -230,7 +228,7 @@
The "`-pkg`" flag can be used to select the specific subset of packages of interest for a given report.
-#
+#
## Frequently Asked Questions {#FAQ}
@@ -262,19 +260,19 @@
mydomain.com/greetings coverage: 100.0% of statements
rsc.io/quote coverage: 25.0% of statements
rsc.io/sampler coverage: 86.7% of statements
-$
+$
```
#### Can I use `go build -cover` in GO111MODULE=off mode? {#gopathmode}
-Yes, `go build -cover` does work with `GO111MODULE=off`.
+Yes, `go build -cover` does work with `GO111MODULE=off`.
When building a program in GO111MODULE=off mode, only the package specifically named as the target on the command line will be instrumented for profiling. Use the `-coverpkg` flag to include additional packages in the profile.
#### If my program panics, will coverage data be written? {#panicprof}
Programs built with `go build -cover` will only write out complete profile
data at the end of execution if the program invokes `os.Exit()` or returns
-normally from `main.main`.
+normally from `main.main`.
If a program terminates in an unrecovered panic, or if the program hits a
fatal exception (such as a segmentation violation, divide by zero, etc),
profile data from statements executed during the run will be lost.
diff --git a/_content/testing/index.md b/_content/testing/index.md
deleted file mode 100644
index e3a279a..0000000
--- a/_content/testing/index.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: Go Testing
-layout: article
----
-
-## Overview
-
-This page provides selected topics related to testing Go code.
-
-## Go Testing
-
-### Go Coverage Testing
-
-[Coverage testing for integration tests in Go](/testing/coverage) shows how to use Go to collect coverage profiles for larger programs (applications, integrations tests), starting in Go 1.20.
-
diff --git a/internal/redirect/redirect.go b/internal/redirect/redirect.go
index f471547..6ed1681 100644
--- a/internal/redirect/redirect.go
+++ b/internal/redirect/redirect.go
@@ -128,6 +128,10 @@
"/doc/articles/slices_usage_and_internals.html": "/blog/go-slices-usage-and-internals",
"/doc/go_for_cpp_programmers.html": "/wiki/GoForCPPProgrammers",
"/doc/go_tutorial.html": "/tour",
+
+ // These moved.
+ "/testing/": "/doc/",
+ "/testing/coverage/": "/doc/build-cover",
}
var newIssueRedirects = [...]string{
diff --git a/internal/redirect/redirect_test.go b/internal/redirect/redirect_test.go
index 7d55bb9..048df14 100644
--- a/internal/redirect/redirect_test.go
+++ b/internal/redirect/redirect_test.go
@@ -37,6 +37,11 @@
"/cmd/gofix": {301, "/cmd/fix/"},
+ "/testing": {301, "/testing/"},
+ "/testing/": {301, "/doc/"},
+ "/testing/coverage": {301, "/testing/coverage/"},
+ "/testing/coverage/": {301, "/doc/build-cover"},
+
// git commits (/change)
// TODO: mercurial tags and LoadChangeMap.
"/change": {301, "https://go.googlesource.com/go"},