From caa5c43c33e8c574a8536f60af16257594781b9c Mon Sep 17 00:00:00 2001 From: Chris Koch Date: Thu, 17 Aug 2023 09:35:42 -0700 Subject: [PATCH] golang: only use GOROOT/bin for path resolution when invoking go command Signed-off-by: Chris Koch --- src/pkg/golang/build.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkg/golang/build.go b/src/pkg/golang/build.go index 57f38401..9bcf6fd2 100644 --- a/src/pkg/golang/build.go +++ b/src/pkg/golang/build.go @@ -178,7 +178,7 @@ func (c Environ) envCommon() []string { func (c Environ) EnvHuman() []string { env := c.envCommon() if c.GOROOT != "" { - env = append(env, fmt.Sprintf("PATH=%s:$PATH", filepath.Join(c.GOROOT, "bin"))) + env = append(env, fmt.Sprintf("PATH=%s", filepath.Join(c.GOROOT, "bin"))) } return env } @@ -188,9 +188,9 @@ func (c Environ) Env() []string { env := c.envCommon() if c.GOROOT != "" { // If GOROOT is set to a different version of Go, we must - // ensure that $GOROOT/bin is also in path to make the "go" - // binary available to golang.org/x/tools/packages. - env = append(env, fmt.Sprintf("PATH=%s:%s", filepath.Join(c.GOROOT, "bin"), os.Getenv("PATH"))) + // ensure that $GOROOT/bin is the path to make the "go" binary + // available to golang.org/x/tools/packages. + env = append(env, fmt.Sprintf("PATH=%s", filepath.Join(c.GOROOT, "bin"))) } return env }