Read line 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 (
    "bufio"
    "fmt"
    "os"
)

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