func listSubscriptions(client *pubsub.Client, argv []string) { checkArgs(argv, 1) subs, err := client.Subscriptions(context.Background()) if err != nil { log.Fatalf("Listing subscriptions failed: %v", err) } for _, s := range subs { fmt.Println(s.Name()) } }
func listSubscriptions(client *pubsub.Client, argv []string) { ctx := context.Background() checkArgs(argv, 1) subs := client.Subscriptions(ctx) for { switch sub, err := subs.Next(); err { case nil: fmt.Println(sub.Name()) case pubsub.Done: return default: log.Fatalf("Listing subscriptions failed: %v", err) } } }