From 1959b9484bdc26edf73d408bc18942427354ff0d Mon Sep 17 00:00:00 2001 From: Peter Ebden Date: Mon, 9 Sep 2024 11:00:04 +0100 Subject: [PATCH] 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. --- tools/please_go/ChangeLog | 4 ++++ tools/please_go/VERSION | 2 +- tools/please_go/cover/cover.go | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/please_go/ChangeLog b/tools/please_go/ChangeLog index aaf79152..ab83f742 100644 --- a/tools/please_go/ChangeLog +++ b/tools/please_go/ChangeLog @@ -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) diff --git a/tools/please_go/VERSION b/tools/please_go/VERSION index 141f2e80..ace44233 100644 --- a/tools/please_go/VERSION +++ b/tools/please_go/VERSION @@ -1 +1 @@ -1.15.0 +1.15.1 diff --git a/tools/please_go/cover/cover.go b/tools/please_go/cover/cover.go index dd06281b..156ae3c2 100644 --- a/tools/please_go/cover/cover.go +++ b/tools/please_go/cover/cover.go @@ -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