Since rulegen is only tested by inspecting and running its output code, we have no good way to see if any chunks of its source are actually being unused. Code coverage only works as part of 'go test', since it needs to instrument our code. Add a script that sets up a tiny test for that purpose, with a quick example on how to use it. We need to use a script, because there's no other way to make this work without breaking 'go run *.go'. It's far more common to run the generator than to obtain a coverage profile, so this solution seems like the right tradeoff, and we don't break existing users. The script isn't terribly portable, but that's okay for now. At the time of wriging, coverage sits at 89.7%. I've manually skimmed main.go and rulegen.go, and practically all unused code is either error handling, or optional code like *genLog and "if false". A couple of small exceptions stand out, though I'm not paying attention to them in this CL. While at it, inline a couple of tiny unusedInspector methods that were only needed once or twice. Change-Id: I78c5fb47c8536d70e546a437637d4428ec7adfaa Reviewed-on: https://go-review.googlesource.com/c/go/+/212760 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> |
||
|---|---|---|
| .github | ||
| api | ||
| doc | ||
| lib/time | ||
| misc | ||
| src | ||
| test | ||
| .gitattributes | ||
| .gitignore | ||
| AUTHORS | ||
| CONTRIBUTING.md | ||
| CONTRIBUTORS | ||
| LICENSE | ||
| PATENTS | ||
| README.md | ||
| SECURITY.md | ||
| favicon.ico | ||
| robots.txt | ||
README.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://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.