Skip to content

Instantly share code, notes, and snippets.

@crgimenes
Created February 2, 2017 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crgimenes/374e645e1e0ee7b3a1fde824731e8471 to your computer and use it in GitHub Desktop.
Save crgimenes/374e645e1e0ee7b3a1fde824731e8471 to your computer and use it in GitHub Desktop.
Simplest way to read from stdin
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