Created
June 2, 2016 05:04
-
-
Save kidtronnix/3c2551e1bc476cc91e36c62944715a6d to your computer and use it in GitHub Desktop.
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 ( | |
"encoding/csv" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
) | |
// assuming there is a users.csv to read from... | |
func main() { | |
f, err := os.Open("users.csv") | |
if err != nil { | |
log.Fatal(err) | |
} | |
r := csv.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