aboutsummaryrefslogtreecommitdiffhomepage
path: root/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/main_test.go b/main_test.go
index c5a59828f..eda829dbb 100644
--- a/main_test.go
+++ b/main_test.go
@@ -396,8 +396,13 @@ func testSetupFunc() func(env *testscript.Env) error {
keyVals = append(keyVals, "SOURCE", sourceDir)
goVersion := runtime.Version()
- // Strip all but the major and minor version.
- goVersion = regexp.MustCompile(`^go(\d+\.\d+)`).FindStringSubmatch(goVersion)[1]
+
+ goVersion = strings.TrimPrefix(goVersion, "go")
+ if !strings.HasSuffix(goVersion, ".0") {
+ // Strip patch version.
+ goVersion = goVersion[:strings.LastIndex(goVersion, ".")]
+ }
+
keyVals = append(keyVals, "GOVERSION", goVersion)
envhelpers.SetEnvVars(&env.Vars, keyVals...)