mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
misc/dist: only build race toolchain where available, fix file upload
R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/8343046
This commit is contained in:
parent
5d1c7bd1a6
commit
edca83e23a
23
misc/dist/bindist.go
vendored
23
misc/dist/bindist.go
vendored
@ -81,7 +81,14 @@ var tourContent = []string{
|
|||||||
"tour.article",
|
"tour.article",
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileRe = regexp.MustCompile(`^go\.([a-z0-9-.]+)\.(src|([a-z0-9]+)-([a-z0-9]+))\.`)
|
// The os-arches that support the race toolchain.
|
||||||
|
var raceAvailable = []string{
|
||||||
|
"darwin-amd64",
|
||||||
|
"linux-amd64",
|
||||||
|
"windows-amd64",
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileRe = regexp.MustCompile(`^(go[a-z0-9-.]+)\.(src|([a-z0-9]+)-([a-z0-9]+))\.`)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
@ -132,6 +139,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
b.OS = p[0]
|
b.OS = p[0]
|
||||||
b.Arch = p[1]
|
b.Arch = p[1]
|
||||||
|
if *includeRace {
|
||||||
|
for _, t := range raceAvailable {
|
||||||
|
if t == targ {
|
||||||
|
b.Race = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := b.Do(); err != nil {
|
if err := b.Do(); err != nil {
|
||||||
log.Printf("%s: %v", targ, err)
|
log.Printf("%s: %v", targ, err)
|
||||||
@ -141,6 +155,7 @@ func main() {
|
|||||||
|
|
||||||
type Build struct {
|
type Build struct {
|
||||||
Source bool // if true, OS and Arch must be empty
|
Source bool // if true, OS and Arch must be empty
|
||||||
|
Race bool // build race toolchain
|
||||||
OS string
|
OS string
|
||||||
Arch string
|
Arch string
|
||||||
root string
|
root string
|
||||||
@ -185,7 +200,7 @@ func (b *Build) Do() error {
|
|||||||
} else {
|
} else {
|
||||||
_, err = b.run(src, "bash", "make.bash")
|
_, err = b.run(src, "bash", "make.bash")
|
||||||
}
|
}
|
||||||
if *includeRace {
|
if b.Race {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -197,8 +212,8 @@ func (b *Build) Do() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Re-install std without -race, so that we're not left with
|
// Re-install std without -race, so that we're not left
|
||||||
// a slower, race-enabled cmd/go, cmd/godoc, etc.
|
// with a slower, race-enabled cmd/go, cmd/godoc, etc.
|
||||||
_, err = b.run(src, goCmd, "install", "-a", "std")
|
_, err = b.run(src, goCmd, "install", "-a", "std")
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user