aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cover/html.go
AgeCommit message (Collapse)Author
2022-09-08cmd/cover: use strings.Buildercuiweixie
Change-Id: Ifb51cb4ed98a93742ce4b221137a0ad73b939b06 Reviewed-on: https://go-review.googlesource.com/c/go/+/428286 Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-03-25cmd/cover: use golang.org/x/tools/cover directlyTobias Klauser
As suggested by Bryan in CL 249759, remove the forwarding aliases in cmd/cover and use the symbols from golang.org/x/tools directly. cmd/cover is not an importable package, so it is fine to remove these exported symbols. Change-Id: I887c5e9349f2dbe4c90be57f708412b844e18081 Reviewed-on: https://go-review.googlesource.com/c/go/+/304690 Trust: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-30cmd/cover: include a package name in the HTML titleRob Pike
A recent change added a title to the HTML coverage report but neglected to include the package name. Add the package name here. It's a little trickier than you'd think because there may be multiple packages and we don't want to parse the files, so we just extract a directory name from the path of the first file. This will almost always be right, and has the advantage that it gives a better result for package main. There are rare cases it will get wrong, but that will be no hardship. If this turns out not to be good enough, we can refine it. Fixes #38609 Change-Id: I2201f6caef906e0b0258b90d7de518879041fe72 Reviewed-on: https://go-review.googlesource.com/c/go/+/230517 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-20cmd/cover: add <title> tag to <head> for coverage report HTML templateDavid Carter
Adds a missing <title> tag to the HTML template to make it more compliant as <title> tags are generally required for valid HTML documents. Change-Id: I1ab2a6ee221c8a79d3cc13d9ac6110f6f4963914 GitHub-Last-Rev: 6d519dc9dda01d142e7f367e43e13c37896cc0cf GitHub-Pull-Request: golang/go#38313 Reviewed-on: https://go-review.googlesource.com/c/go/+/227547 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-10cmd/cover: invoke go command to find packagesRuss Cox
cmd/cover has always assumed that package x/y/z can be found in $GOPATH/src/x/y/z (roughly; by using go/build). That won't be true for too much longer. Instead, run the go command to find out where packages are. This will make 'go tool cover' safe for use with Go modules when they are in use in Go 1.11, and it continues to work with the existing Go toolchains too. An alternative would be to modify the cover profile format to record file names directly, but that would require also updating golang.org/x/tools/cover/profile and any tools that use it, which seems not worth the trouble. (That fork of the code does not contain any code to resolve package names to directory locations, so it's unaffected.) No new test here: cmd/go's TestCoverageFunc tests this code. Fixes #25318 (when people use Go 1.11 instead of vgo). Change-Id: I8769b15107aecf25f7aaf8692b724cf7d0f073d0 Reviewed-on: https://go-review.googlesource.com/122478 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
2018-03-26all: use strings.Builder instead of bytes.Buffer where appropriateBrad Fitzpatrick
I grepped for "bytes.Buffer" and "buf.String" and mostly ignored test files. I skipped a few on purpose and probably missed a few others, but otherwise I think this should be most of them. Updates #18990 Change-Id: I5a6ae4296b87b416d8da02d7bfaf981d8cc14774 Reviewed-on: https://go-review.googlesource.com/102479 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-17cmd/cover: don't ignore os.Create errorDaniel Martí
Failing to create the output file would give confusing errors such as: cover: invalid argument Also do out.Close() even if Execute() errored. Fixes #17951. Change-Id: I897e1d31f7996871c54fde7cb09614cafbf6c3fc Reviewed-on: https://go-review.googlesource.com/33278 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-09-14cmd: add internal/browser packageJosh Bleecher Snyder
cmd/cover, cmd/trace, and cmd/pprof all open browsers. 'go bug' will soon also open a browser. It is time to unify the browser-handling code. Change-Id: Iee6b443e21e938aeaaac366a1aefb1afbc7d9b2c Reviewed-on: https://go-review.googlesource.com/29160 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-27cmd/cover: allow part selection to be retained across page refreshesShenghou Ma
Usually, you are primarily interested to see the coverage of a particular file (e.g. when you're changing tests that affects a given source file), it is very valuable if you can just refresh the page and immediately see changes to the part you're already looking at (without selecting from the selector again.) Change-Id: I615207c9be6713f436e444771134fceaf4600ff3 Reviewed-on: https://go-review.googlesource.com/17238 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-05-01cmd/cover: try once again to fix the buildRob Pike
Forgot to update the references to the old cover package. No excuse. Change-Id: If17b7521f0bf70bc0c8da9c5adf246d90f644637 Reviewed-on: https://go-review.googlesource.com/9564 Reviewed-by: Rob Pike <r@golang.org>
2015-05-01cmd/cover: fix buildRob Pike
TBR=rsc Change-Id: I6ec69013027213c5e7adedd2edb89dea6af876d9 Reviewed-on: https://go-review.googlesource.com/9563 Reviewed-by: Rob Pike <r@golang.org>
2015-05-01cmd/cover: copy to standard repository from golang.org/x/tools/cmd/coverRob Pike
This required dealing with the ill-advised split of the profile code into a separate package. I just copied it over unchanged. The package does not deserve to be in the standard repository. We can cope with the duplication. Also update the go command to know about the new location. Fixes #10528. Change-Id: I05170ef3663326d57b9c18888d01163acd9256b6 Reviewed-on: https://go-review.googlesource.com/9560 Reviewed-by: Russ Cox <rsc@golang.org>