This is a creation in Article, where the information may have evolved or changed.
Cui Hua, on the code
Package Mainimport ("Bufio" "FMT" "OS" "Strings") Func main () {//reading data from standard inputInputreader: =Bufio. Newreader (OS. Stdin) fmt. Println ("Please input your name:") //read data until you meet \ n LocationInput, err: = Inputreader.readstring ('\ n') ifErr! =Nil {fmt. Printf ("An error occurred:%s\n", Err)//exit after exception errorOs. Exit (1) } Else { //delete the last \ n using the slice operationName: = Input[:len (Input)-1] FMT. Printf ("hello,%s! What can I di for you?\n", Name)} for{input, err= Inputreader.readstring ('\ n') ifErr! =Nil {fmt. Printf ("An error occurred:%s\n", Err)Continue} input= Input[:len (Input)-1] //convert all to lowercaseinput =strings. ToLower (Input)SwitchInput { Case "": Continue Case " Nothing","Bye": FMT. Println ("bye!") //Normal ExitOs. Exit (0) default: FMT. Println ("sorry,i didn ' t catch you.") } }}