func delgroup(c cmd, conn *ec2.EC2, args []string) { run := parallel.NewRun(40) for _, g := range args { g := g run.Do(func() error { var ec2g ec2.SecurityGroup if secGroupPat.MatchString(g) { ec2g.Id = g } else { ec2g.Name = g } _, err := conn.DeleteSecurityGroup(ec2g) if err != nil { errorf("cannot delete %q: %v", g, err) return errgo.Newf("error") } return nil }) } if run.Wait() != nil { os.Exit(1) } }