-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the options pattern #101
Conversation
Signed-off-by: Victor Perez <[email protected]>
csvcopy.WithReportingPeriod(reportingPeriod), | ||
csvcopy.WithVerbose(verbose), | ||
} | ||
if headerLinesCnt > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be:
if headerLinesCnt > 1 { | |
if headerLinesCnt > 0 { |
Otherwise you'll enter the fail branch of WithSkipHeaderCount
:
if headerLineCount == 0 {
return errors.New("header line count must be greater than zero")
}
Another thing, this changes the current behavior. I'm not saying the pass behavior is the best either. The old behavior is, if skip == false
then it doesn't matter the value of headerLinesCnt
, nothing is going to be skipped. By default headers are not skipped.
With you changes, since headerLinesCnt
defaults to 1
, and you are not requiring skip == true
to set the value for skip, then we are defaulting to always skip the first line.
I'd rather not change the old behavior, and if we do it, let's document it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a point, I was excited about the change and decided that this behavior was a bit better. But there is no real reason to change it. So I'm going to leave it as it was.
I'm going to leave the option to just set skip header, as that is the most common configuration and the one we will be using on our system.
…escaledb-parallel-copy into vperez/use-options-pattern
Using the options pattern makes a clean interface for the package that will be easier to maintain in the long run.