package main import ( "fmt" "io" "os" "time" ) /* @Ref: https://livebook.manning.com/book/go-in-practice/chapter-3/65 `os.Stdin` and `os.Stdout` will be used as the system input and output. It's great. */ func main() { go echo(os.Stdin, os.Stdout) time.Sleep(30 * time.Second) fmt.Println("Time out.") os.Exit(0) } func echo(in io.Reader, out io.Writer) { io.Copy(out, in) }