Skip to content

Instantly share code, notes, and snippets.

@deepakkadarivel
Forked from kendellfab/read_line.go
Created November 12, 2017 09:28
Show Gist options
  • Select an option

  • Save deepakkadarivel/1b470b99f0bcf02b7d05335a0d6d7a76 to your computer and use it in GitHub Desktop.

Select an option

Save deepakkadarivel/1b470b99f0bcf02b7d05335a0d6d7a76 to your computer and use it in GitHub Desktop.

Revisions

  1. @kendellfab kendellfab created this gist Nov 11, 2013.
    10 changes: 10 additions & 0 deletions read_line.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    func readLine(path string) {
    inFile, _ := os.Open(path)
    defer inFile.Close()
    scanner := bufio.NewScanner(inFile)
    scanner.Split(bufio.ScanLines)

    for scanner.Scan() {
    fmt.Println(scanner.Text())
    }
    }