mirror of
https://github.com/restic/restic.git
synced 2026-11-19 12:15:22 +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:
1 parent
a0966e1d1d
commit
c2ff7150aa
3 files changed
+3
-4
No files matched your search
@@ -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