mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03:00
parent
111f02db2a
commit
24b1be45c1
26 changed files with 438 additions and 108 deletions
|
@ -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...)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue