I want to output to stdout and have the output \"overwrite\" the previous output.
For example; if I output On 1/10, I want the next output On 2/10
On 1/10
On 2/10
The solution for one string which will replace whole string
fmt.Printf("\033[2K\r%d", i)
For example, it correctly prints from 10 to 0:
for i:= 10; i>=0; i-- { fmt.Printf("\033[2K\r%d", i) time.Sleep(1 * time.Second) } fmt.Println()
which previous answers don't solve.