Use t.Tempdir

Signed-off-by: Julien <roidelapluie@o11y.eu>
This commit is contained in:
Julien 2024-09-03 11:37:29 +02:00
parent 2c553b1772
commit 1f02c2177b

View file

@ -22,10 +22,7 @@ import (
)
func TestGenerateChecksum(t *testing.T) {
// Create a temporary directory to hold the test files.
tmpDir, err := os.MkdirTemp("", "checksum_test")
require.NoError(t, err)
defer os.RemoveAll(tmpDir) // Clean up.
tmpDir := t.TempDir()
// Define paths for the temporary files.
yamlFilePath := filepath.Join(tmpDir, "test.yml")