Read from stdin (keyboard)


Read from the stdin (standard input) Get input from the keyboard in golang


examples/read_from_stdin/read_from_stdin.go
package main

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

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