Add -no-clean flag to cross-compile.go

This commit is contained in:
Nick Craig-Wood 2017-05-15 09:36:55 +01:00
parent 64d7489fd2
commit df0cfa9735

View File

@ -26,6 +26,7 @@ var (
include = flag.String("include", "^.*$", "os/arch regexp to include") include = flag.String("include", "^.*$", "os/arch regexp to include")
exclude = flag.String("exclude", "^$", "os/arch regexp to exclude") exclude = flag.String("exclude", "^$", "os/arch regexp to exclude")
cgo = flag.Bool("cgo", false, "Use cgo for the build") cgo = flag.Bool("cgo", false, "Use cgo for the build")
noClean = flag.Bool("no-clean", false, "Don't clean the build directory before running.")
) )
// GOOS/GOARCH pairs we build for // GOOS/GOARCH pairs we build for
@ -184,8 +185,10 @@ func main() {
log.Fatalf("Syntax: %s <version>", os.Args[0]) log.Fatalf("Syntax: %s <version>", os.Args[0])
} }
version := args[0] version := args[0]
run("rm", "-rf", "build") if !*noClean {
run("mkdir", "build") run("rm", "-rf", "build")
run("mkdir", "build")
}
err := os.Chdir("build") err := os.Chdir("build")
if err != nil { if err != nil {
log.Fatalf("Couldn't cd into build dir: %v", err) log.Fatalf("Couldn't cd into build dir: %v", err)