Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Last active December 21, 2015 20:19
Show Gist options
  • Select an option

  • Save tmtk75/6360740 to your computer and use it in GitHub Desktop.

Select an option

Save tmtk75/6360740 to your computer and use it in GitHub Desktop.
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
file, err := os.Open("file_Scanner.go")
defer file.Close()
if err != nil {
panic(err)
}
sc := bufio.NewScanner(file)
for i := 0; sc.Scan(); i++ {
fmt.Println(i, sc.Text())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment