func main() { flags, err := parseFlags() if err != nil { fmt.Println(`Wrong duration format, it should be such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"`) os.Exit(1) } // Looks for the file to send // TODO directory if len(flag.Args()) < 1 { fmt.Printf("Usage: %s [flags] file1 file2\n", os.Args[0]) flag.PrintDefaults() } c := client.NewClient(flags) var wg sync.WaitGroup // Send each file. for _, filename := range flag.Args() { wg.Add(1) go sendFile(&wg, c, filename) } wg.Wait() // Wait for all routine to stop }
func main() { flag.Parse() cli := client.NewClient(&opts) sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) cli.Main() <-sigChan println("") }
func main() { url := os.Getenv("URL") vpc := os.Getenv("VPC") aws_access_key_id := os.Getenv("AWS_ACCESS_KEY_ID") aws_secret_key := os.Getenv("AWS_SECRET_ACCESS_KEY") remote, err := client.NewClient(url, aws_access_key_id, aws_secret_key) instances, err := remote.ListInstances(vpc) if err != nil { log.Fatal(err.Error()) } log.Print(instances) }