Don't use runtime.Version() to find the current go version
am: fde8534680
Change-Id: Ief8f39921e5e833ca4e31db445050239bdf21b91
This commit is contained in:
commit
eb22dda417
2 changed files with 16 additions and 2 deletions
|
@ -67,8 +67,22 @@ var (
|
|||
verbose = false
|
||||
|
||||
goToolDir = filepath.Join(runtime.GOROOT(), "pkg", "tool", runtime.GOOS+"_"+runtime.GOARCH)
|
||||
goVersion = findGoVersion()
|
||||
)
|
||||
|
||||
func findGoVersion() string {
|
||||
if version, err := ioutil.ReadFile(filepath.Join(runtime.GOROOT(), "VERSION")); err == nil {
|
||||
return string(version)
|
||||
}
|
||||
|
||||
cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "version")
|
||||
if version, err := cmd.Output(); err == nil {
|
||||
return string(version)
|
||||
} else {
|
||||
panic(fmt.Sprintf("Unable to discover go version: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
type GoPackage struct {
|
||||
Name string
|
||||
|
||||
|
@ -218,7 +232,7 @@ func (p *GoPackage) Compile(outDir, trimPath string) error {
|
|||
shaFile := p.output + ".hash"
|
||||
|
||||
hash := sha1.New()
|
||||
fmt.Fprintln(hash, runtime.GOOS, runtime.GOARCH, runtime.Version())
|
||||
fmt.Fprintln(hash, runtime.GOOS, runtime.GOARCH, goVersion)
|
||||
|
||||
cmd := exec.Command(filepath.Join(goToolDir, "compile"),
|
||||
"-o", p.output,
|
||||
|
|
|
@ -53,7 +53,7 @@ function run_go
|
|||
{
|
||||
# Increment when microfactory changes enough that it cannot rebuild itself.
|
||||
# For example, if we use a new command line argument that doesn't work on older versions.
|
||||
local mf_version=1
|
||||
local mf_version=2
|
||||
|
||||
local mf_src="${TOP}/build/soong/cmd/microfactory"
|
||||
|
||||
|
|
Loading…
Reference in a new issue