mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/goversion: add new package, move Go 1.x constant there out of go/build
Found by Josh, who says in the bug that it shrinks cmd/compile by 1.6 MB (6.5%). Fixes #31563 Change-Id: I35127af539630e628a0a4f2273af519093536c38 Reviewed-on: https://go-review.googlesource.com/c/go/+/172997 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
97252f620f
commit
64e29f94e2
6 changed files with 52 additions and 13 deletions
|
|
@ -19,7 +19,7 @@ import (
|
|||
"cmd/internal/sys"
|
||||
"flag"
|
||||
"fmt"
|
||||
"go/build"
|
||||
"internal/goversion"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
|
@ -1426,8 +1426,7 @@ var flag_lang string
|
|||
|
||||
// currentLang returns the current language version.
|
||||
func currentLang() string {
|
||||
tags := build.Default.ReleaseTags
|
||||
return tags[len(tags)-1]
|
||||
return fmt.Sprintf("go1.%d", goversion.Version)
|
||||
}
|
||||
|
||||
// goVersionRE is a regular expression that matches the valid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue