func (s *Spinner) Start() {
	s.lock.Lock()
	if s.active {
		s.lock.Unlock()
		return
	}
	s.active = true
	s.lock.Unlock()
	go func() {
		for {
			for i := 0; i < len(s.chars); i++ {
				select {
				case <-s.stopChan:
					return
				default:
					s.lock.Lock()
					s.erase()
					if !s.active {
						return
					}
					outPlain := fmt.Sprintf("%s%s%s ", s.Prefix, s.chars[i], s.Suffix)
					fmt.Fprint(s.Writer, outPlain)
					s.lastOutput = outPlain
					delay := s.Delay
					s.lock.Unlock()
					time.Sleep(delay)
				}
			}
		}
	}()
}
Start will start the indicator
package spinner
import (
	"fmt"
	"io"
	"io/ioutil"
	"sync"
	"time"
	"unicode/utf8"
)
type Spinner struct {
	Delay      time.Duration  
	chars      []string       
	Prefix     string         
	Suffix     string         
	FinalMSG   string         
	lastOutput string         
	lock       *sync.RWMutex  
	Writer     io.Writer      
	active     bool           
	stopChan   chan struct{}  
	HideCursor bool           
}
func New(cs []string, d time.Duration, options ...Option) *Spinner {
	s := &Spinner{
		Delay:    d,
		chars:    cs,
		lock:     &sync.RWMutex{},
		Writer:   ioutil.Discard,
		active:   false,
		stopChan: make(chan struct{}, 1),
	}
	for _, option := range options {
		option(s)
	}
	return s
}
type Option func(*Spinner)
type Options struct {
	Suffix     string
	FinalMSG   string
	HideCursor bool
}
func WithFinalMSG(finalMsg string) Option {
	return func(s *Spinner) {
		s.FinalMSG = finalMsg
	}
}
func WithHiddenCursor(hideCursor bool) Option {
	return func(s *Spinner) {
		s.HideCursor = hideCursor
	}
}
func (s *Spinner) Active() bool {
	return s.active
}