Skip to content

Commit

Permalink
Add some missing defer calls to Close
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Franssen <marco.franssen@philips.com>
  • Loading branch information
marcofranssen committed Dec 1, 2021
1 parent 75cb706 commit 6a59561
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/slsa-provenance/cli/github-release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func createGitHubRelease(ctx context.Context, client *github.ReleaseClient, owne
if err != nil {
return 0, err
}
defer asset.Close()
client.AddProvenanceToRelease(ctx, owner, repo, rel.GetID(), asset)
}

Expand Down
1 change: 1 addition & 0 deletions lib/github/provenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (e *ReleaseEnvironment) PersistProvenanceStatement(ctx context.Context, stm
if err != nil {
return fmt.Errorf("failed to open provenance statement: %w", err)
}
defer stmtFile.Close()

owner := e.Context.RepositoryOwner
repo := repositoryName(e.Context.Repository)
Expand Down
3 changes: 3 additions & 0 deletions lib/github/releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func TestAddProvenanceToRelease(t *testing.T) {
if !assert.NoError(err) || !assert.NotNil(provenance) {
return
}
defer provenance.Close()

stat, err := provenance.Stat()
if !assert.NoError(err) || !assert.NotNil(stat) {
Expand Down Expand Up @@ -212,6 +213,8 @@ func createGitHubRelease(ctx context.Context, client *github.ReleaseClient, owne
if err != nil {
return 0, err
}
defer asset.Close()

client.AddProvenanceToRelease(ctx, owner, repo, rel.GetID(), asset)
}

Expand Down

0 comments on commit 6a59561

Please sign in to comment.