Skip to content

Commit

Permalink
close file after using (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff66ruan authored and stanislas-m committed Sep 19, 2019
1 parent 99e77bf commit 3ef63dc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func LoadConfigFile() error {
if err != nil {
return err
}
defer f.Close()
return LoadFrom(f)
}

Expand Down
4 changes: 3 additions & 1 deletion file_migrator.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package pop

import (
"github.com/pkg/errors"
"os"
"path/filepath"

"github.com/pkg/errors"
)

// FileMigrator is a migrator for SQL and Fizz
Expand All @@ -26,6 +27,7 @@ func NewFileMigrator(path string, c *Connection) (FileMigrator, error) {
if err != nil {
return err
}
defer f.Close()
content, err := MigrationContent(mf, tx, f, true)
if err != nil {
return errors.Wrapf(err, "error processing %s", mf.Path)
Expand Down
1 change: 1 addition & 0 deletions soda/cmd/schema/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var LoadCmd = &cobra.Command{
if err != nil {
return errors.WithMessage(err, "unable to load schema file")
}
defer f.Close()

c, err := pop.Connect(loadOptions.env)
if err != nil {
Expand Down

0 comments on commit 3ef63dc

Please sign in to comment.