cmd/go: fix -coverpkg=all with dot imports
If you use -coverpkg=all you get coverage for all packages in the build. Go 1.9 used a global counter for all the GoCover variables, so that they were distinct for the entire build. The global counter caused problems with caching, so we switched to a per-package counter. But now the GoCover_0 in one package may be dot-imported into another and conflict with the GoCover_0 in that other package. Reestablish (overwhelmingly likely) global uniqueness of GoCover variables by appending an _xxxxxxxxxxxx suffix, where the x's are the prefix of the SHA256 hash of the import path. The point is only to avoid accidents, not to defeat people determined to break the tools. Fixes #23432. Change-Id: I3088eceebbe35174f2eefe8d558b7c8b59d3eeac Reviewed-on: https://go-review.googlesource.com/89135Reviewed-by: Ian Lance Taylor <iant@golang.org>
Showing
Please
register
or
sign in
to comment