A pretty common task, especially for new programmers, is to ask the user to type in some value at the command line and then have the program act on it. (think "interactive maze game", "determine if word is palindrome", etc). It would be nice if we had an example in the os package showing how to do this.
The text was updated successfully, but these errors were encountered:
I don't think that belongs in the os package documentation (a new programmer is unlikely to look there first for help). What you suggest would belong more in a tutorial, like the Go tour, which already has a lot of basic examples, though nothing about reading console input.
If this hasn't been taken yet, I should be able to do this. The line example (provided here: https://golang.org/pkg/bufio/#Scanner) is perfect for what I think you are looking for. I may adapt the example but it should be a pretty quick addition to the docs...