summaryrefslogtreecommitdiff
path: root/data/data.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-08-04 19:52:09 -0400
committerDave Henderson <dhenderson@gmail.com>2022-08-04 19:54:51 -0400
commitf67ce5ac8d8bc3f47563dd6512946d8947cf412a (patch)
tree4697b947e9d6eeec1479c29cdd661ced2dd5effb /data/data.go
parentf13bcfdd78e0e502947addb3b3f0556bbbf9edf5 (diff)
Fix lint errors
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'data/data.go')
-rw-r--r--data/data.go39
1 files changed, 24 insertions, 15 deletions
diff --git a/data/data.go b/data/data.go
index 0c81dc54..96f82e7f 100644
--- a/data/data.go
+++ b/data/data.go
@@ -258,10 +258,13 @@ func autoIndex(i int) string {
// CSV - Unmarshal CSV
// parameters:
-// delim - (optional) the (single-character!) field delimiter, defaults to ","
-// in - the CSV-format string to parse
+//
+// delim - (optional) the (single-character!) field delimiter, defaults to ","
+// in - the CSV-format string to parse
+//
// returns:
-// an array of rows, which are arrays of cells (strings)
+//
+// an array of rows, which are arrays of cells (strings)
func CSV(args ...string) ([][]string, error) {
records, hdr, err := parseCSV(args...)
if err != nil {
@@ -275,13 +278,16 @@ func CSV(args ...string) ([][]string, error) {
// CSVByRow - Unmarshal CSV in a row-oriented form
// parameters:
-// delim - (optional) the (single-character!) field delimiter, defaults to ","
-// hdr - (optional) comma-separated list of column names,
-// set to "" to get auto-named columns (A-Z), omit
-// to use the first line
-// in - the CSV-format string to parse
+//
+// delim - (optional) the (single-character!) field delimiter, defaults to ","
+// hdr - (optional) comma-separated list of column names,
+// set to "" to get auto-named columns (A-Z), omit
+// to use the first line
+// in - the CSV-format string to parse
+//
// returns:
-// an array of rows, indexed by the header name
+//
+// an array of rows, indexed by the header name
func CSVByRow(args ...string) (rows []map[string]string, err error) {
records, hdr, err := parseCSV(args...)
if err != nil {
@@ -299,13 +305,16 @@ func CSVByRow(args ...string) (rows []map[string]string, err error) {
// CSVByColumn - Unmarshal CSV in a Columnar form
// parameters:
-// delim - (optional) the (single-character!) field delimiter, defaults to ","
-// hdr - (optional) comma-separated list of column names,
-// set to "" to get auto-named columns (A-Z), omit
-// to use the first line
-// in - the CSV-format string to parse
+//
+// delim - (optional) the (single-character!) field delimiter, defaults to ","
+// hdr - (optional) comma-separated list of column names,
+// set to "" to get auto-named columns (A-Z), omit
+// to use the first line
+// in - the CSV-format string to parse
+//
// returns:
-// a map of columns, indexed by the header name. values are arrays of strings
+//
+// a map of columns, indexed by the header name. values are arrays of strings
func CSVByColumn(args ...string) (cols map[string][]string, err error) {
records, hdr, err := parseCSV(args...)
if err != nil {