Skip to content
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

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yuhangcangqian
Copy link

@yuhangcangqian yuhangcangqian commented Mar 8, 2025

Description

TempDir returns a temporary directory for the test to use.The directory is automatically removed when the test and
all its subtests complete. More info https://pkg.go.dev/testing#B.TempDir

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

troian and others added 2 commits March 6, 2025 14:49
…1969)

This avoids saving the genesisDoc to database.
When using goleveldb and ~4GiB+ genesis files,
it causes a panic during snappy encoding
(panic: snappy: decoded block is too large).
@yuhangcangqian yuhangcangqian requested a review from a team as a code owner March 8, 2025 05:05
@github-actions github-actions bot added the C:CLI label Mar 8, 2025
@troian
Copy link
Member

troian commented Mar 8, 2025

hi @yuhangcangqian thanks for the PR.
what issue does it resolve?

@yuhangcangqian
Copy link
Author

hi @yuhangcangqian thanks for the PR. what issue does it resolve?

There will be no changes to the functionality, but it can make the code cleaner. This method was specifically added by the Go team to address the common need for creating temporary directories in tests, as the original approach was quite cumbersome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants