Skip to content

refactor: use t.TempDir() instead of os.MkdirTemp #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MarkDaveny
Copy link

TempDir() is a method introduced in Go 1.15 for testing.T. It automatically creates a temporary directory and cleans it up after the test is complete, eliminating the hassle of manually handling errors and cleanup. More detail about TempDir https://pkg.go.dev/testing#B.TempDir

@mbrandenburger mbrandenburger self-assigned this Apr 9, 2025
@mbrandenburger mbrandenburger added testing All related to testing cleanup Something needs some cleanup labels Apr 9, 2025
Copy link
Member

@mbrandenburger mbrandenburger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarkDaveny thanks for this PR! This make the test setup much cleaner!

Can we update the following tests as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Something needs some cleanup testing All related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants