Skip to content

Commit

Permalink
Use more specific names for coverage variables to avoid clashes (#299)
Browse files Browse the repository at this point in the history
We see a couple of cases in the main plz repo where we seem to be
picking up existing variables named things like `goCoverageFile`; I can
only assume there is some kind of prefix search happening in 1.23.

This makes them `_plz_goCover` which I think we can reasonably assume no
sensible Go program is going to use.
  • Loading branch information
peterebden authored Sep 9, 2024
1 parent 004a8b3 commit 1959b94
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tools/please_go/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.15.1
--------------
* Use more specific names for coverage variables to avoid clashes

Version 1.15.0
--------------
* Add support for Go 1.23 coverage generation (#294)
Expand Down
2 changes: 1 addition & 1 deletion tools/please_go/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.0
1.15.1
4 changes: 2 additions & 2 deletions tools/please_go/cover/cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func WriteCoverage(goTool, coverTool, covercfg, output, pkg string, srcs []strin
}
var cmd *exec.Cmd
if coverTool != "" {
cmd = exec.Command(coverTool, append([]string{"-mode=set", "-var=goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
cmd = exec.Command(coverTool, append([]string{"-mode=set", "-var=_plz_goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
} else {
cmd = exec.Command(goTool, append([]string{"tool", "cover", "-mode=set", "-var=goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
cmd = exec.Command(goTool, append([]string{"tool", "cover", "-mode=set", "-var=_plz_goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down

0 comments on commit 1959b94

Please sign in to comment.