We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ce73c29 + c0d2b89 commit d9bd547Copy full SHA for d9bd547
go/extractor/toolchain/toolchain.go
@@ -36,7 +36,14 @@ func GetEnvGoVersion() string {
36
// being told what's already in 'go.mod'. Setting 'GOTOOLCHAIN' to 'local' will force it
37
// to use the local Go toolchain instead.
38
cmd := Version()
39
- cmd.Env = append(os.Environ(), "GOTOOLCHAIN=local")
+
40
+ // If 'GOTOOLCHAIN' is already set, then leave it as is. This allows us to force a specific
41
+ // Go version in tests and also allows users to override the system default more generally.
42
+ _, hasToolchainVar := os.LookupEnv("GOTOOLCHAIN")
43
+ if !hasToolchainVar {
44
+ cmd.Env = append(os.Environ(), "GOTOOLCHAIN=local")
45
+ }
46
47
out, err := cmd.CombinedOutput()
48
49
if err != nil {
0 commit comments