Commits


Eng Zer Jun authored and GitHub committed b1d36c026df
ARROW-17340: [Go] Use `T.TempDir` to create temporary test directory (#13816) A testing cleanup. This pull request replaces `ioutil.TempDir` 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("", "") if err != nil { t.Fatal(err) } defer os.RemoveAll(tmpDir) // now tmpDir := t.TempDir() } ``` Authored-by: Eng Zer Jun <engzerjun@gmail.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>