From f579faa69dec37d388823b9cd0d54d739f40570b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 18 Jan 2013 16:24:00 -0500 Subject: [PATCH] cmd/go: diagnose un-bootstrapped runtime Fixes #4665. R=golang-dev, minux.ma CC=golang-dev https://golang.org/cl/7132057 --- src/cmd/go/build.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 776aa5e0df3..4591225ef49 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -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 {