Skip to content

Commit

Permalink
golang: only use GOROOT/bin for path resolution when invoking go command
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Koch <[email protected]>
  • Loading branch information
hugelgupf committed Dec 24, 2023
1 parent 2bc8167 commit caa5c43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pkg/golang/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit caa5c43

Please sign in to comment.