如何使GO程序等待用户输入? [重复]

This question already has an answer here:

package main

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

func main() {
    fmt.Println("insert y value here: ")
    input := bufio.NewScanner(os.Stdin)
    fmt.Println(input.Text)
}

How do I make the program wait, until the user inputs data?

</div>

Scanner isn't really ideal for reading command line input (see the answer HectorJ referenced above), but if you want to make it work, it's a call to Scan() that you're missing (also note that Text() is a method call):

func main() {
    fmt.Print("insert y value here: ")
    input := bufio.NewScanner(os.Stdin)
    input.Scan()
    fmt.Println(input.Text())
}