mirror of
https://github.com/restic/restic.git
synced 2025-08-12 11:47:43 +00:00
internal: check error before deferring file Close()
If there is an error, file will be `nil`. We should check the returned error before deferring file `Close()`.
This commit is contained in:
@@ -94,8 +94,8 @@ func Random(seed, count int) []byte {
|
||||
// SetupTarTestFixture extracts the tarFile to outputDir.
|
||||
func SetupTarTestFixture(t testing.TB, outputDir, tarFile string) {
|
||||
input, err := os.Open(tarFile)
|
||||
defer input.Close()
|
||||
OK(t, err)
|
||||
defer input.Close()
|
||||
|
||||
var rd io.Reader
|
||||
switch filepath.Ext(tarFile) {
|
||||
|
Reference in New Issue
Block a user