diff --git a/okta/fixtures_test.go b/okta/fixtures_test.go index 4774e9599..e0d09c754 100644 --- a/okta/fixtures_test.go +++ b/okta/fixtures_test.go @@ -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) diff --git a/okta/utils.go b/okta/utils.go index fe7a48f56..c24be3c75 100644 --- a/okta/utils.go +++ b/okta/utils.go @@ -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)) }