tar/asm: go vet fixes

on go1.19.7

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2023-03-25 14:41:27 -04:00
parent 80a436fd61
commit 70fb294a9b
Signed by: vbatts
GPG Key ID: E30EFAA812C6E5ED
1 changed files with 9 additions and 5 deletions

View File

@ -18,12 +18,13 @@ func TestLargeJunkPadding(t *testing.T) {
// Write a normal tar file into the pipe and then load it full of junk // Write a normal tar file into the pipe and then load it full of junk
// bytes as padding. We have to do this in a goroutine because we can't // bytes as padding. We have to do this in a goroutine because we can't
// store 20GB of junk in-memory. // store 20GB of junk in-memory.
go func() { var err error
go func(e error) {
// Empty archive. // Empty archive.
tw := tar.NewWriter(pW) tw := tar.NewWriter(pW)
if err := tw.Close(); err != nil { if err := tw.Close(); err != nil {
pW.CloseWithError(err) pW.CloseWithError(err)
t.Fatal(err) e = err
return return
} }
@ -35,7 +36,7 @@ func TestLargeJunkPadding(t *testing.T) {
devZero, err := os.Open("/dev/zero") devZero, err := os.Open("/dev/zero")
if err != nil { if err != nil {
pW.CloseWithError(err) pW.CloseWithError(err)
t.Fatal(err) e = err
return return
} }
defer devZero.Close() defer devZero.Close()
@ -45,14 +46,17 @@ func TestLargeJunkPadding(t *testing.T) {
} }
if _, err := io.CopyN(pW, devZero, junkChunkSize); err != nil { if _, err := io.CopyN(pW, devZero, junkChunkSize); err != nil {
pW.CloseWithError(err) pW.CloseWithError(err)
t.Fatal(err) e = err
return return
} }
} }
fmt.Fprintln(os.Stderr, "[TestLargeJunkPadding] junk chunk finished") fmt.Fprintln(os.Stderr, "[TestLargeJunkPadding] junk chunk finished")
pW.Close() pW.Close()
}() }(err)
if err != nil {
t.Fatal(err)
}
// Disassemble our junk file. // Disassemble our junk file.
nilPacker := storage.NewJSONPacker(ioutil.Discard) nilPacker := storage.NewJSONPacker(ioutil.Discard)