test: use `T.TempDir` to create temporary test directory
Created by: Juneezee
Test plan
A small testing enhancement.
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.
Reference: https://pkg.go.dev/testing#T.TempDir