Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
github.com/recursionpharma/go-csv-map
A wrapper around golang's encoding/csv providing map-based access
go get github.com/recursionpharma/go-csv-map
import (
"bytes"
"fmt"
"os"
"github.com/recursionpharma/go-csv-map"
)
buf := bytes.NewBufferString("Album,Year\nDark Side of the Moon,1973\nExile On Main St,1972")
reader := csvmap.NewReader(buf)
reader.Columns, err := reader.ReadHeader()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
records, err := reader.ReadAll()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(records[1]["Year"])
// Output: 1972
import (
"bytes"
"fmt"
"os"
"github.com/recursionpharma/go-csv-map"
)
buf := bytes.NewBufferString("Dark Side of the Moon,1973\nExile On Main St,1972")
reader := csvmap.NewReader(buf)
reader.Columns = []string{"Album", "Year"}
if err != nil {
fmt.Println(err)
os.Exit(1)
}
records, err := reader.ReadAll()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(records[1]["Year"])
// Output: 1972
csvmap.Reader.Reader
gives you access to the underlying csv.Reader
object.
import (
"bytes"
"fmt"
"os"
"github.com/recursionpharma/go-csv-map"
)
buf := bytes.NewBufferString("Album;Year\nDark Side of the Moon;1973\nExile On Main St;1972")
reader := csvmap.NewReader(buf)
reader.Reader.Comma = ';'
reader.Columns, err := reader.ReadHeader()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
records, err := reader.ReadAll()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(records[1]["Year"])
// Output: 1972
import (
"bytes"
"fmt"
"os"
"github.com/recursionpharma/go-csv-map"
)
buf := bytes.NewBufferString("Album;Year\nDark Side of the Moon;1973\nExile On Main St;1972")
reader := csvmap.NewReader(buf)
reader.Reader.FieldsPerRecord = 3
reader.Columns, err := reader.ReadHeader()
fmt.Println(err != nil)
// Output: true
code/go-csv-map/
|-- csvmap.go
| Main code
|-- csvmap_test.go
| Tests
|-- examples_test.go
| Examples
|-- .gitignore
| Files git will ignore
|-- LICENSE
| MIT License
|-- README.md
| This file
`-- .travis.yml
Travis configuration
The above file tree was generated with tree -a -L 1 --charset ascii
.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.