Use T.TempDir for temporary dirs in tests (#3580)

This commit is contained in:
Cristian Dominguez 2021-05-07 10:21:26 +00:00 committed by GitHub
parent 25d79c4e16
commit 2f94adabb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 40 deletions

View file

@ -261,12 +261,11 @@ func TestFindLegacy(t *testing.T) {
}
func TestExtractName(t *testing.T) {
tmpfile, err := ioutil.TempFile("", "gh-cli")
tmpfile, err := ioutil.TempFile(t.TempDir(), "gh-cli")
if err != nil {
t.Fatal(err)
}
tmpfile.Close()
defer os.Remove(tmpfile.Name())
defer tmpfile.Close()
type args struct {
filePath string
@ -322,12 +321,11 @@ about: This is how you report bugs
}
func TestExtractContents(t *testing.T) {
tmpfile, err := ioutil.TempFile("", "gh-cli")
tmpfile, err := ioutil.TempFile(t.TempDir(), "gh-cli")
if err != nil {
t.Fatal(err)
}
tmpfile.Close()
defer os.Remove(tmpfile.Name())
defer tmpfile.Close()
type args struct {
filePath string