aboutsummaryrefslogtreecommitdiffstats
path: root/skate/xio
diff options
context:
space:
mode:
Diffstat (limited to 'skate/xio')
-rw-r--r--skate/xio/util.go7
1 files changed, 4 insertions, 3 deletions
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