Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Sep 23, 2024
1 parent b3878fb commit 3b8ecb2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions verifier/crl/crl.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,13 @@ func (c *FileCache) Set(ctx context.Context, url string, bundle *corecrl.Bundle)
defer os.Remove(tmpFile.Name())
}
}()
err = json.NewEncoder(tmpFile).Encode(content)
if err != nil {

if err := json.NewEncoder(tmpFile).Encode(content); err != nil {
return fmt.Errorf("failed to store crl bundle in file cache: failed to encode content: %w", err)

Check warning on line 167 in verifier/crl/crl.go

View check run for this annotation

Codecov / codecov/patch

verifier/crl/crl.go#L167

Added line #L167 was not covered by tests
}

// rename is atomic on UNIX-like platforms
err = os.Rename(tmpFile.Name(), filepath.Join(c.root, c.fileName(url)))
if err != nil {
if err := os.Rename(tmpFile.Name(), filepath.Join(c.root, c.fileName(url))); err != nil {
return fmt.Errorf("failed to store crl bundle in file cache: %w", err)
}
return nil
Expand Down

0 comments on commit 3b8ecb2

Please sign in to comment.