[dev.cc] cmd/dist: bootstrap Go toolchain using Go 1.4

Bootstrap the Go parts of the Go toolchain using Go 1.4,
as described in https://golang.org/s/go15bootstrap.

The first Go part of the Go toolchain will be cmd/objwriter,
but for now that's just an empty program to test that this
new code works.

Once the build dashboard is okay with this change,
we'll make objwriter a real program depended upon by the build.

Change-Id: Iad3dce675571cbdb5ab6298fe6f98f53ede47d5c
Reviewed-on: https://go-review.googlesource.com/3044
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2015-01-19 12:57:35 -05:00
parent 283b23297a
commit 328ace91e6
4 changed files with 191 additions and 12 deletions

25
src/cmd/dist/util.go vendored
View file

@ -275,7 +275,7 @@ func xremoveall(p string) {
os.RemoveAll(p)
}
// xreaddir replaces dst with a list of the names of the files in dir.
// xreaddir replaces dst with a list of the names of the files and subdirectories in dir.
// The names are relative to dir; they are not full paths.
func xreaddir(dir string) []string {
f, err := os.Open(dir)
@ -290,6 +290,27 @@ func xreaddir(dir string) []string {
return names
}
// xreaddir replaces dst with a list of the names of the files in dir.
// The names are relative to dir; they are not full paths.
func xreaddirfiles(dir string) []string {
f, err := os.Open(dir)
if err != nil {
fatal("%v", err)
}
defer f.Close()
infos, err := f.Readdir(-1)
if err != nil {
fatal("reading %s: %v", dir, err)
}
var names []string
for _, fi := range infos {
if !fi.IsDir() {
names = append(names, fi.Name())
}
}
return names
}
// xworkdir creates a new temporary directory to hold object files
// and returns the name of that directory.
func xworkdir() string {
@ -370,6 +391,8 @@ func main() {
if gohostarch == "" {
fatal("$objtype is unset")
}
case "windows":
exe = ".exe"
}
sysinit()