Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

Commit ac25467

Browse files
authored
Merge pull request #2 from silvertern/master
Start to returns the spinner to compress new & start & defer stop in one line…
2 parents 389dc5a + beda41f commit ac25467

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ func (s *Spinner) Set(frames string) {
5555
}
5656

5757
// Start shows the spinner.
58-
func (s *Spinner) Start() {
58+
func (s *Spinner) Start() *Spinner {
5959
if atomic.LoadUint64(&s.active) > 0 {
60-
return
60+
return s
6161
}
6262
atomic.StoreUint64(&s.active, 1)
6363
go func() {
@@ -66,6 +66,7 @@ func (s *Spinner) Start() {
6666
time.Sleep(100 * time.Millisecond)
6767
}
6868
}()
69+
return s
6970
}
7071

7172
// Stop hides the spinner.

0 commit comments

Comments
 (0)