frictionlessdata / tableschema-go

A Go library for working with Table Schema.
MIT License
46 stars 10 forks source link

Error trying to CastTable. #83

Closed joeberth closed 4 years ago

joeberth commented 4 years ago

Overview

Error when using the csv employee, the schema and trying to use the function CastTable(tab table.Table, out interface{}). References the out argument of this function to this struct

Using this function produces following error: "strconv.ParseInt: parsing " 2020": invalid syntax"

Which is strange, because when adding the test case directly to the integer_test.go of the tableschema-go, it does not produce an error.

This error is fixed when i delete white spaces before call CastTable.


@danielfireman

danielfireman commented 4 years ago

HI @joeberth, thanks for reporting!

The library behavior is correct. If you would like to strip the prefixed whitespaces you need to set bareNumber: false in the schema field. The behavior is documented here and implemented here.