aboutsummaryrefslogtreecommitdiffstats
path: root/skate/map.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/map.go')
-rw-r--r--skate/map.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/skate/map.go b/skate/map.go
index c448848..698725a 100644
--- a/skate/map.go
+++ b/skate/map.go
@@ -130,7 +130,10 @@ func CreateFixedMapper(field string) Mapper {
}
f := func(p []byte) ([][]byte, error) {
result := gjson.GetBytes(p, field)
- key := []byte(result.String())
+ // A subtle bug can emerge here: By default we use tab as separator. If
+ // the value extracted ends with the separator (e.g. tab), then we get
+ // an invalid row. Hence, trim all space.
+ key := []byte(strings.TrimSpace(result.String()))
return [][]byte{key, p}, nil
}
return f