Consider the following basic program:
package main
import (
"fmt"
"time"
"github.com/briandowns/spinner"
)
func main() {
mySpinner := spinner.New(spinner.CharSets[11], 100 * time.Millisecond)
mySpinner.Suffix = " Starting spinner"
mySpinner.Start()
time.Sleep(500 * time.Millisecond)
i := 0
for {
mySpinner.Stop()
fmt.Printf("This is message #%d\n", i)
mySpinner.Restart()
i += 1
time.Sleep(500 * time.Millisecond)
}
}
The expected behavior is that the fmt.Printf(...) lines are printed one by one, with just the spinner running below it. However, after some time (usually less than printing 100 lines in my limited testing), the spinner no longer appears below the output of invocations of fmt.Printf(...) and all that appears is just the lines being printed.
I've also tried wrapping the Restart() call like so:
for ok := true; ok; ok = !mySpinner.Active() {
mySpinner.Restart()
}
but this doesn't seem to fix the issue - the execution proceeds without the spinner.
Consider the following basic program:
The expected behavior is that the
fmt.Printf(...)lines are printed one by one, with just the spinner running below it. However, after some time (usually less than printing 100 lines in my limited testing), the spinner no longer appears below the output of invocations offmt.Printf(...)and all that appears is just the lines being printed.I've also tried wrapping the
Restart()call like so:but this doesn't seem to fix the issue - the execution proceeds without the spinner.