@@ -78,14 +78,11 @@ func TestTarLimits(t *testing.T) {
7878 t .Fatal (err )
7979 }
8080
81- td , err := os .MkdirTemp ("" , "getter" )
82- if err != nil {
83- t .Fatalf ("err: %s" , err )
84- }
81+ td := t .TempDir ()
8582
8683 tarFilePath := filepath .Join (td , "input.tar" )
8784
88- err = os .WriteFile (tarFilePath , b .Bytes (), 0666 )
85+ err : = os .WriteFile (tarFilePath , b .Bytes (), 0666 )
8986 if err != nil {
9087 t .Fatalf ("err: %s" , err )
9188 }
@@ -129,15 +126,12 @@ func TestTarLimits(t *testing.T) {
129126
130127// testDecompressPermissions decompresses a directory and checks the permissions of the expanded files
131128func testDecompressorPermissions (t * testing.T , d Decompressor , input string , expected map [string ]int , umask os.FileMode ) {
132- td , err := os .MkdirTemp ("" , "getter" )
133- if err != nil {
134- t .Fatalf ("err: %s" , err )
135- }
129+ td := t .TempDir ()
136130
137131 // Destination is always joining result so that we have a new path
138132 dst := filepath .Join (td , "subdir" , "result" )
139133
140- err = d .Decompress (dst , input , true , umask )
134+ err : = d .Decompress (dst , input , true , umask )
141135 if err != nil {
142136 t .Fatalf ("err: %s" , err )
143137 }
0 commit comments