Juneezee opened a new pull request, #13816:
URL: https://github.com/apache/arrow/pull/13816

   A testing cleanup. 
   
   This pull request replaces `ioutil.TempDir` and `os.MkdirTemp` with 
`t.TempDir`. We can use the `T.TempDir` function from the `testing` package to 
create temporary directory. The directory created by `T.TempDir` is 
automatically removed when the test and all its subtests complete. 
   
   This saves us at least 2 lines (error check, and cleanup) on every instance, 
or in some cases adds cleanup that we forgot.
   
   Reference: https://pkg.go.dev/testing#T.TempDir
   
   ```go
   func TestFoo(t *testing.T) {
        // before
        tmpDir, err := ioutil.TempDir("", "")
        require.NoError(t, err)
        defer os.RemoveAll(tmpDir)
   
        // now
        tmpDir := t.TempDir()
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to