prow/cmd/tackle/main.go
func createCluster(proj, choice string) (*cluster, error) {
	const def = "prow"
	if choice == "" {
		fmt.Printf("Cluster name [%s]: ", def)
		fmt.Scanln(&choice)
		if choice == "" {
			choice = def
		}
	}

	cmd := exec.Command("gcloud", "container", "clusters", "create", choice)
	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	if err := cmd.Run(); err != nil {
		return nil, fmt.Errorf("create cluster: %v", err)
	}

	out, err := output("gcloud", "container", "clusters", "describe", choice, "--format=value(name,zone)")
	if err != nil {
		return nil, fmt.Errorf("describe cluster: %v", err)
	}
	parts := strings.Split(out, "\t")
	if len(parts) != 2 {
		return nil, fmt.Errorf("bad describe cluster output: %s", out)
	}

	return &cluster{name: parts[0], zone: parts[1], project: proj}, nil
}
func createCluster(proj, choice string) (*cluster, error) {
	const def = "prow"
	if choice == "" {
		fmt.Printf("Cluster name [%s]: ", def)
		fmt.Scanln(&choice)
		if choice == "" {
			choice = def
		}
	}

	cmd := exec.Command("gcloud", "container", "clusters", "create", choice)
	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	if err := cmd.Run(); err != nil {
		return nil, fmt.Errorf("create cluster: %v", err)
	}

	out, err := output("gcloud", "container", "clusters", "describe", choice, "--format=value(name,zone)")
	if err != nil {
		return nil, fmt.Errorf("describe cluster: %v", err)
	}
	parts := strings.Split(out, "\t")
	if len(parts) != 2 {
		return nil, fmt.Errorf("bad describe cluster output: %s", out)
	}

	return &cluster{name: parts[0], zone: parts[1], project: proj}, nil
}
func createCluster ( proj , choice string ) ( * cluster , error ) { const def = " " if choice == " " { fmt . Printf ( " " , def ) fmt . Scanln ( & choice ) if choice == " " { choice = def } } cmd := exec . Command ( " " , " " , " " , " " , choice ) cmd . Stdin = os . Stdin cmd . Stdout = os . Stdout cmd . Stderr = os . Stderr if err := cmd . Run ( ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } out , err := output ( " " , " " , " " , " " , choice , " " ) if err != nil { return nil , fmt . Errorf ( " " , err ) } parts := strings . Split ( out , " \t " ) if len ( parts ) != 2 { return nil , fmt . Errorf ( " " , out ) } return & cluster { name : parts [ 0 ] , zone : parts [ 1 ] , project : proj } , nil }
// createCluster causes gcloud to create a cluster in project, returning the context name
createCluster causes gcloud to create a cluster in project returning the context name