This is a creation in Article, where the information may have evolved or changed.
https://www.kancloud.cn/kancloud/the-way-to-go/72679
Examples
Func getmsg () (msg string) { Reader: = Bufio. Newreader (OS. Stdin) If err! = Nil { FMT. Println (Err. Error ()) } return}
Briefly summarize:
Reader is a pointer because of BUFIO. The interface of the Newreader () constructor is the func newreader (rd IO. Reader) *reader
(*reader, as can be seen from here)
1. Reader: = Bufio. Newreader (OS. Stdin), a reader was created
2.msg, err: = Reader. ReadString (' \ n ')
ReadString (Delim byte) is a method.
Reads to the Delim character and ends, and returns Error=nil to err.
So msg gets the OS. stdin the input string plus (' \ n ') wrapping. ( remember )
Finally, the MSG is returned, corresponding to the function name, and the msg+ (' \ n ') information is obtained.