Skip to content

Instantly share code, notes, and snippets.

@freeeve
Last active August 29, 2015 14:05
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 freeeve/0f34676f9afec053915a to your computer and use it in GitHub Desktop.
Save freeeve/0f34676f9afec053915a to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
filename := os.Args[1]
file, err := os.Open(filename)
if err != nil {
panic(err)
}
r := bufio.NewReader(file) // the magic happens here
for {
line, err := r.ReadString('\n')
if err != nil {
fmt.Println(err)
break
}
fmt.Printf("%s", line)
}
}
An afternoon breeze
expels cold air, along with
the fallen brown leaves.
Cherry blossoms bloom,
softly falling from the tree,
explode into night.
地理
湖沼
ダム湖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment