Got it:

package main

import(
    "fmt"
    "time"
    )

func main() {
  fmt.Printf("Hello")
  time.Sleep(time.Second)
  time.Sleep(time.Second)
  fmt.Printf("\r")
  fmt.Printf("World\n")
}

在2022年4月1日星期五 UTC+8 15:34:08<Henry> 写道:

> You can use the ansi escape code if the target terminal supports it. 
> Alternatively, you can use the carriage return '\r' and reprint the line. 
> Note you may need to overwrite with empty space to delete the line before 
> rewriting it.
>
> On Friday, April 1, 2022 at 12:38:37 PM UTC+7 yan.z...@gmail.com wrote:
>
>> I just noticed how python pip upgraded from printing numerous process 
>> bars like this:
>> ■■■                   30% completed
>> ■■■■                 40% completed
>> ■■■■■■            60% completed
>> ■■■■■■■■       80% completed
>> ■■■■■■■■■■  100% completed
>>
>> to a single line of a growing bar and changing declaration.
>>
>> It is definitely a functionality that  prompts of both Linux and Windows 
>> allows -
>> To change the previous print line.
>> Is it possible to realize this in golang?
>>
>>   Zhaoxun
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/702dad6d-006f-47b5-94d5-ca231b0245fcn%40googlegroups.com.

Reply via email to