Skip to content

Instantly share code, notes, and snippets.

@jadeallenx
Created August 19, 2012 04:07
Show Gist options
  • Save jadeallenx/3391855 to your computer and use it in GitHub Desktop.
Save jadeallenx/3391855 to your computer and use it in GitHub Desktop.
Solution for #83 learngo
package main
import (
"fmt"
"io/ioutil"
"strings"
"log"
)
func main() {
in, err := ioutil.ReadFile("todo.sample")
if err != nil {
log.Fatal("Couldn't open todo.sample", err)
}
line := strings.Split(string(in), "\n")
for i := 0; i < len(line); i++ {
fmt.Printf("%d %s\n", i, line[i])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment