1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
package main import ( "fmt" "strings" "time" ) func main() { const col = 30 // Clear the screen by printing \x0c. bar := fmt.Sprintf("\x0c[%%-%vs]", col) for i := 0; i < col; i++ { fmt.Printf(bar, strings.Repeat("=", i)+">") time.Sleep(100 * time.Millisecond) } fmt.Printf(bar+" Done!", strings.Repeat("=", col)) } |
1 |
[==============================] Done! |