Skip to content

Commit

Permalink
Ensure files are getting closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
monde committed Jun 10, 2022
1 parent ebf873f commit b3063ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions okta/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (manager *fixtureManager) GetFixtures(fixtureName string, rInt int, t *test
if err != nil {
t.Fatalf("failed to load terraform fixtures for ACC test, err: %v", err)
}
defer file.Close()
rawFile, err := ioutil.ReadAll(file)
if err != nil {
t.Fatalf("failed to load terraform fixtures for ACC test, err: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion okta/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ func computeFileHash(filename string) string {
if err != nil {
return ""
}
defer file.Close()
h := sha256.New()
if _, err := io.Copy(h, file); err != nil {
log.Fatal(err)
}
_ = file.Close()
return hex.EncodeToString(h.Sum(nil))
}

Expand Down

0 comments on commit b3063ec

Please sign in to comment.