f2ee341468
Some of the unit tests in Go's "cmd" tree wind up building a separate copy of the tool being tested, then exercise the freshly built tool as a way of doing regression tests. The intent is to make sure that "go test" is testing the current state of the source code, as opposed to whatever happened to be current when "go install <tool>" was last run. Doing things this way is unfriendly for coverage testing. If I run "go test -cover cmd/mumble", and the cmd/mumble test harness builds a fresh copy of mumble.exe, any runs of that new executable won't generate coverage data. This patch updates the test harnesses to use the unit test executable as a stand-in for the tool itself, so that if "go test -cover" is in effect, we get the effect of building the tool executable for coverage as well. Doing this brings up the overall test coverage number for cmd/cover quite dramatically: before change: $ go test -cover . ok cmd/cover 1.100s coverage: 1.5% of statements after change: $ go test -cover . ok cmd/cover 1.299s coverage: 84.2% of statements Getting this to work requires a small change in the Go command as well, to set GOCOVERDIR prior to executing a test binary. Updates #51430. Change-Id: Ifcf0ea85773b80fcda794aae3702403ec8e0b733 Reviewed-on: https://go-review.googlesource.com/c/go/+/404299 Reviewed-by: Bryan Mills <bcmills@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.