bumpy-spoon-55438
09/24/2022, 3:34 AMfast-nail-55400
09/24/2022, 3:54 AMPATH when running tests. See https://github.com/pantsbuild/pants/blob/1bced7cf2f918345f032c31f9ff3393784e6ece0/src/python/pants/backend/go/goals/test.py#L368-L373 for where the env is setup for Go test runs.fast-nail-55400
09/24/2022, 3:54 AM$GOROOT/bin on the PATH?fast-nail-55400
09/24/2022, 4:00 AMgo toolchain source, it appears to always append the $GOROOT/bin to the PATH when invoking the test binary.fast-nail-55400
09/24/2022, 4:04 AMfast-nail-55400
09/24/2022, 4:04 AMfast-nail-55400
09/24/2022, 4:04 AMbumpy-spoon-55438
09/24/2022, 4:06 AMbumpy-spoon-55438
09/24/2022, 4:06 AMbumpy-spoon-55438
09/24/2022, 4:07 AMbumpy-spoon-55438
09/24/2022, 4:07 AMos.Setenv("PATH", strings.Join([]string{"$GOROOT/bin", os.Getenv("PATH")}, ":"))fast-nail-55400
09/24/2022, 4:07 AMbumpy-spoon-55438
09/24/2022, 4:10 AM[test]
extra_env_vars = [
"PATH=$GOROOT/bin:$PATH"
]fast-nail-55400
09/24/2022, 4:11 AMfast-nail-55400
09/24/2022, 4:11 AMfunc init() {}fast-nail-55400
09/24/2022, 4:12 AMfast-nail-55400
09/24/2022, 4:12 AMfunc init() {
goroot := os.Getenv("GOROOT")
if goroot != "" {
path := os.Getenv("PATH")
if path != "" {
os.Setenv("PATH", fmt.Sprintf("%s/bin:%s", goroot, path)
} else {
os.Setenv("PATH", fmt.Sprintf("%s/bin", goroot)
}
}
}fast-nail-55400
09/24/2022, 4:14 AMstrings.Join and filepath.Join instead of fmt.Sprintfbumpy-spoon-55438
09/24/2022, 4:16 AMfast-nail-55400
09/24/2022, 4:16 AMfast-nail-55400
09/24/2022, 4:17 AMGoSdkProcess which sets the GOROOT automatically. I'll have to add that to the issue to set as well.fast-nail-55400
09/24/2022, 4:18 AMGOROOT explicitly via --test-extra-env and then that would be available to the test runfast-nail-55400
09/24/2022, 4:18 AM$GOROOT/bin to the PATHbumpy-spoon-55438
09/24/2022, 4:19 AM[test]
extra_env_vars = [
"GOROOT=/opt/homebrew/opt/go/libexec"
]fast-nail-55400
09/24/2022, 4:25 AMfast-nail-55400
09/24/2022, 4:26 AMfast-nail-55400
09/24/2022, 4:30 AMah running the test does not usenote to self: did some research andwhich sets theGoSdkProcessautomatically. I'll have to add that to the issue to set as well.GOROOT
go test does not set GOROOT just modifies the PATHbumpy-spoon-55438
09/24/2022, 4:34 AMfast-nail-55400
09/25/2022, 5:52 PMmain and 2.14.x branches.fast-nail-55400
09/25/2022, 5:53 PM