frictionlessdata / tableschema-go

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

Refactor datetime.go file #54

Closed as27 closed 7 years ago

as27 commented 7 years ago

Inside datetime.go in a case of an error the functions returns time.Now()

func decodeYearMonth(value string, c Constraints) (time.Time, error) {
    y, err := decodeYearMonthWithoutChecks(value)
    if err != nil {
        return time.Now(), err
    }

This could cause a bug, when the caller of the function does not check the returned error. I would suggest to change the return value to an empty time.Time

return time.Time{}, err
danielfireman commented 7 years ago

Great catch, @as27!

as27 commented 7 years ago

I will fix this.