Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 21st, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "io/ioutil"
  6.     "strings"
  7.     "log"
  8. )
  9.  
  10. func main() {
  11.     in, err := ioutil.ReadFile("todo.sample")
  12.     if err != nil {
  13.         log.Fatal("Couldn't open todo.sample", err)
  14.     }
  15.     line := strings.Split(string(in), "\n")
  16.     for i := 0; i < len(line); i++ {
  17.         fmt.Printf("%d %s\n", i, line[i])
  18.     }
  19. }