Skip to content

Commit

Permalink
Merge pull request #606 from xushiwei/q
Browse files Browse the repository at this point in the history
library: bufio, encoding/csv
  • Loading branch information
xushiwei authored Jul 29, 2024
2 parents 6597cc9 + cc37097 commit eae1c5d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ Here are the Go packages that can be imported correctly:
* [flag](https://pkg.go.dev/flag)
* [sort](https://pkg.go.dev/sort)
* [bytes](https://pkg.go.dev/bytes)
* [bufio](https://pkg.go.dev/bufio)
* [strings](https://pkg.go.dev/strings)
* [strconv](https://pkg.go.dev/strconv)
* [path](https://pkg.go.dev/path)
Expand All @@ -295,6 +296,7 @@ Here are the Go packages that can be imported correctly:
* [encoding/hex](https://pkg.go.dev/encoding/hex)
* [encoding/base32](https://pkg.go.dev/encoding/base32)
* [encoding/base64](https://pkg.go.dev/encoding/base64)
* [encoding/csv](https://pkg.go.dev/encoding/csv)
* [regexp](https://pkg.go.dev/regexp)
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)

Expand Down
30 changes: 30 additions & 0 deletions _cmptest/csvdemo/csv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
"encoding/csv"
"fmt"
"io"
"log"
"strings"
)

func main() {
in := `first_name,last_name,username
"Rob","Pike",rob
Ken,Thompson,ken
"Robert","Griesemer","gri"
`
r := csv.NewReader(strings.NewReader(in))

for {
record, err := r.Read()
if err == io.EOF {
break
}
if err != nil {
log.Fatal(err)
}

fmt.Println(record)
}
}

0 comments on commit eae1c5d

Please sign in to comment.