1
0
mirror of https://github.com/golang/go synced 2024-09-29 16:24:28 -06:00

cmd/go: diagnose un-bootstrapped runtime

Fixes #4665.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7132057
This commit is contained in:
Russ Cox 2013-01-18 16:24:00 -05:00
parent e985d5464b
commit f579faa69d

View File

@ -649,6 +649,16 @@ func (b *builder) do(root *action) {
wg.Wait()
}
// hasString reports whether s appears in the list of strings.
func hasString(strings []string, s string) bool {
for _, t := range strings {
if s == t {
return true
}
}
return false
}
// build is the action for building a single package or command.
func (b *builder) build(a *action) (err error) {
defer func() {
@ -669,6 +679,11 @@ func (b *builder) build(a *action) (err error) {
fmt.Fprintf(os.Stderr, "%s\n", a.p.ImportPath)
}
if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" &&
!hasString(a.p.HFiles, "zasm_"+buildContext.GOOS+"_"+buildContext.GOARCH+".h") {
return fmt.Errorf("%s/%s must be bootstrapped using make.bash", buildContext.GOOS, buildContext.GOARCH)
}
// Make build directory.
obj := a.objdir
if err := b.mkdir(obj); err != nil {