func spinner(stop <-chan struct{}) {
	for {
		select {
		case <-stop:
			return
		default:
			for _, r := range `-\|/` {
				fmt.Printf("\r%c", r)
				time.Sleep(80 * time.Millisecond)
			}
		}
	}
}
spinner displays a spinner on the std output
package main
import (
	"flag"
	"fmt"
	"log"
	"net/url"
	"os"
	"strconv"
	"time"
	"github.com/ChimeraCoder/anaconda"
)
var searchTerm = flag.String("s", "", "(required) search term to find users by (i.e. gopher)")
var maxFollow = flag.Int("max", 50, "(optional) max number of users to follow (hard maximum of 100 to avoid limiting by Twitter)")
var alreadyFollowing []anaconda.User
var toFollow []anaconda.User
func main() {
	api, err := newTwitterAPI()
	if err != nil {
		log.Fatal(err)
	}
	flag.Parse()
	if len(*searchTerm) == 0 {
		flag.PrintDefaults()
		os.Exit(1)
	}
	const hardMaxFollow = 100
	if *maxFollow > hardMaxFollow {
		*maxFollow = hardMaxFollow
	}
	alreadyFollowing = getAllFriends(api)
	fmt.Println("Finding users...")
	done := make(chan struct{})
	go spinner(done)  
	found := 0
	n, err := findUsers(api)
	if err != nil {
		log.Fatal(err)
	}
	found += n
	n, err = findUsersByTweet(api)
	if err != nil {
		log.Fatal(err)
	}
	done <- struct{}{}
	found += n
	fmt.Printf("\rFound %d unique users\n", found)
	if found == 0 {
		fmt.Println("Try a broader search term next time!")
		os.Exit(0)
	}
	const userURLFormat = "https://twitter.com/%s"
	fmt.Println("Following...")
	newFriends := 0
	for _, user := range toFollow {
		err := followUser(api, user.Id)
		if err != nil {
			log.Print(fmt.Errorf("could not follow %s: %v\n", user.ScreenName, err))
			break  
		}
		fmt.Printf("%-40s%-s\n", user.Name, fmt.Sprintf(userURLFormat, user.ScreenName))
		newFriends++
	}
	fmt.Println("-------------------------------------------------------------------------------")
	fmt.Printf("You are now following %d new users!\n", newFriends)
}
func newTwitterAPI() (*anaconda.TwitterApi, error) {
	keys := []string{
		"TWITTER_CONSUMER_KEY",
		"TWITTER_CONSUMER_SECRET",
		"TWITTER_ACCESS_TOKEN",
		"TWITTER_ACCESS_SECRET",
	}
	pairs := make(map[string]string, 4)
	for _, k := range keys {
		v := os.Getenv(k)
		if v == "" {
			return nil, fmt.Errorf("environment variable %q required", k)
		}
		pairs[k] = v
	}
	anaconda.SetConsumerKey(pairs["TWITTER_CONSUMER_KEY"])
	anaconda.SetConsumerSecret(pairs["TWITTER_CONSUMER_SECRET"])
	api := anaconda.NewTwitterApi(pairs["TWITTER_ACCESS_TOKEN"], pairs["TWITTER_ACCESS_SECRET"])
	_, err := api.VerifyCredentials()
	if err != nil {
		return nil, err
	}
	return api, nil
}