From 9b494ee939a4fce942780aa42487e004cc95e8ce Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Thu, 2 Jan 2025 09:30:16 -0800 Subject: [PATCH] Use t.TempDir instead of os.MkdirTemp --- cmd/geoipupdate/end_to_end_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/geoipupdate/end_to_end_test.go b/cmd/geoipupdate/end_to_end_test.go index c525191..f0c04a7 100644 --- a/cmd/geoipupdate/end_to_end_test.go +++ b/cmd/geoipupdate/end_to_end_test.go @@ -23,14 +23,12 @@ import ( func TestUpdater(t *testing.T) { // mock existing databases. - tempDir, err := os.MkdirTemp("", "db") - require.NoError(t, err) - defer os.RemoveAll(tempDir) + tempDir := t.TempDir() edition := "edition-1" dbFile := filepath.Join(tempDir, edition+".mmdb") // equivalent MD5: 618dd27a10de24809ec160d6807f363f - err = os.WriteFile(dbFile, []byte("edition-1 content"), os.ModePerm) + err := os.WriteFile(dbFile, []byte("edition-1 content"), os.ModePerm) require.NoError(t, err) edition = "edition-2"