Created
December 25, 2016 15:53
-
-
Save ivan-loh/c92e1b3db986617cdc8064beda41afac to your computer and use it in GitHub Desktop.
reading some csv file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"encoding/csv" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
) | |
func main() { | |
f, _ := os.Open("some/file") | |
r := csv.NewReader(bufio.NewReader(f)) | |
for { | |
record, err := r.Read() | |
if err == io.EOF { | |
break | |
} | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println(record) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment