Skip to content

Commit

Permalink
Function renamed (minor change).
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim2266 committed May 18, 2018
1 parent 0267b3a commit caea594
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions csvplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ func (src DataSource) ToCsv(out io.Writer, columns ...string) (err error) {
// The data are written in the "canonical" form with the header on the first line and with all the lines
// having the same number of fields, using default settings for the underlying csv.Writer.
func (src DataSource) ToCsvFile(name string, columns ...string) error {
return withFile(name, func(file io.Writer) error {
return writeFile(name, func(file io.Writer) error {
return src.ToCsv(file, columns...)
})
}

// call the given function with the file stream open for writing
func withFile(name string, fn func(io.Writer) error) (err error) {
func writeFile(name string, fn func(io.Writer) error) (err error) {
var file *os.File

if file, err = os.Create(name); err != nil {
Expand Down Expand Up @@ -475,8 +475,8 @@ func (src DataSource) ToJSON(out io.Writer) (err error) {
}

// ToJSONFile iterates over the data source and writes all Rows to the given file in JSON format.
func (src DataSource) ToJSONFile(name string) (err error) {
return withFile(name, src.ToJSON)
func (src DataSource) ToJSONFile(name string) error {
return writeFile(name, src.ToJSON)
}

// ToRows iterates the DataSource storing the result in a slice of Rows.
Expand Down

0 comments on commit caea594

Please sign in to comment.