Created
February 2, 2017 12:07
-
-
Save crgimenes/374e645e1e0ee7b3a1fde824731e8471 to your computer and use it in GitHub Desktop.
Simplest way to read from stdin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
) | |
func main() { | |
input, err := ioutil.ReadAll(os.Stdin) | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println(string(input)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment