Skip to content

Commit

Permalink
Add Missing file.Close() calls (#2761)
Browse files Browse the repository at this point in the history
Calls to close files were missing in a couple of places
  • Loading branch information
martinmaly committed Feb 8, 2022
1 parent 5dad3b5 commit 5169954
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/fnruntime/runner.go
Expand Up @@ -470,6 +470,7 @@ func newFnConfig(f *kptfilev1.Function, pkgPath types.UniquePath) (*yaml.RNode,
return nil, errors.E(op, fn,
fmt.Errorf("missing function config %q", f.ConfigPath))
}
defer file.Close()
b, err := ioutil.ReadAll(file)
if err != nil {
return nil, errors.E(op, fn, err)
Expand Down
1 change: 1 addition & 0 deletions pkg/api/kptfile/v1/validation.go
Expand Up @@ -177,6 +177,7 @@ func GetValidatedFnConfigFromPath(pkgPath types.UniquePath, configPath string) (
if err != nil {
return nil, fmt.Errorf("functionConfig must exist in the current package")
}
defer file.Close()
reader := kio.ByteReader{Reader: file, PreserveSeqIndent: true, WrapBareSeqNode: true, DisableUnwrapping: true}
nodes, err := reader.Read()
if err != nil {
Expand Down

0 comments on commit 5169954

Please sign in to comment.