Skip to content

Commit 1959b94

Browse files
authored
Use more specific names for coverage variables to avoid clashes (#299)
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.
1 parent 004a8b3 commit 1959b94

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tools/please_go/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 1.15.1
2+
--------------
3+
* Use more specific names for coverage variables to avoid clashes
4+
15
Version 1.15.0
26
--------------
37
* Add support for Go 1.23 coverage generation (#294)

tools/please_go/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.0
1+
1.15.1

tools/please_go/cover/cover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func WriteCoverage(goTool, coverTool, covercfg, output, pkg string, srcs []strin
4444
}
4545
var cmd *exec.Cmd
4646
if coverTool != "" {
47-
cmd = exec.Command(coverTool, append([]string{"-mode=set", "-var=goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
47+
cmd = exec.Command(coverTool, append([]string{"-mode=set", "-var=_plz_goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
4848
} else {
49-
cmd = exec.Command(goTool, append([]string{"tool", "cover", "-mode=set", "-var=goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
49+
cmd = exec.Command(goTool, append([]string{"tool", "cover", "-mode=set", "-var=_plz_goCover", "-pkgcfg", pkgConfigFile, "-outfilelist", output}, srcs...)...)
5050
}
5151
cmd.Stdout = os.Stdout
5252
cmd.Stderr = os.Stderr

0 commit comments

Comments
 (0)