Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created April 24, 2015 18:03
Show Gist options
  • Save 178inaba/8d485fe3aa556e235eca to your computer and use it in GitHub Desktop.
Save 178inaba/8d485fe3aa556e235eca to your computer and use it in GitHub Desktop.
Macだと標準入力の最大文字数は1024文字(?) ref: http://qiita.com/inaba178/items/81ea3c2f763b45e7e3bc
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
fmt.Println(scanner.Text()) // Println will add back the final '\n'
}
if err := scanner.Err(); err != nil {
fmt.Fprintln(os.Stderr, "reading standard input:", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment