Read from stdin (keyboard) with error handling


examples/read_from_stdin_with_error_handling/read_from_stdin_with_error_handling.go
package main

import (
   "fmt"
   "bufio"
   "os"
)

func main() {
   reader := bufio.NewReader(os.Stdin)
   fmt.Print("Enter Your name: ")
   name, err := reader.ReadString('\n')
   if err != nil {
       fmt.Println(err)
   } else {
       fmt.Println("Hello", name)
   }
}