From 12b3219daf446f385ce574ee8ab71a596bf201fc Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Fri, 28 May 2021 22:48:03 +0200 Subject: xio: tabs docs --- skate/xio/util.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'skate') diff --git a/skate/xio/util.go b/skate/xio/util.go index ead1a5d..de3afb4 100644 --- a/skate/xio/util.go +++ b/skate/xio/util.go @@ -19,6 +19,7 @@ func OpenTwo(f1, f2 string) (g1, g2 *os.File, err error) { return g1, g2, nil } +// TabsToMapFile turns columns from a file into a map. func TabsToMapFile(filename, sep string, kCol, vCol int) (map[string]string, error) { f, err := os.Open(filename) if err != nil { @@ -28,12 +29,12 @@ func TabsToMapFile(filename, sep string, kCol, vCol int) (map[string]string, err return TabsToMap(f, sep, kCol, vCol) } -// TabsToMap read from a reader and turns values from kCol, vCol columns into a -// mapping. +// TabsToMap read from a reader and turns values from kCol, vCol columns +// (1-indexed) into a map. func TabsToMap(r io.Reader, sep string, kCol, vCol int) (map[string]string, error) { var ( br = bufio.NewReader(r) - m = make(map[string]string, 8388608) + m = make(map[string]string) line, k, v string fields []string err error -- cgit v1.2.3