func mustCreateConn() *clientv3.Client { eps := strings.Split(endpoints, ",") endpoint := eps[dialTotal%len(eps)] dialTotal++ client, err := clientv3.NewFromURL(endpoint) if err != nil { fmt.Fprintf(os.Stderr, "dial error: %v\n", err) os.Exit(1) } return client }
func mustClient(cmd *cobra.Command) *clientv3.Client { endpoint, err := cmd.Flags().GetString("endpoint") if err != nil { ExitWithError(ExitError, err) } client, err := clientv3.NewFromURL(endpoint) if err != nil { ExitWithError(ExitBadConnection, err) } return client }