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

testing: rename t.TempDir to t.Mkdir #39169

Closed
rogpeppe opened this issue May 20, 2020 · 4 comments
Closed

testing: rename t.TempDir to t.Mkdir #39169

rogpeppe opened this issue May 20, 2020 · 4 comments
Milestone

Comments

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented May 20, 2020

The originally proposed name for testing.T.TempDir was Mkdir. The name was changed during the proposal process. There has been some confusion about the intended semantics: is it more like ioutil.TempDir or os.TempDir ?

To avoid the confusion, I suggest that we use the originally proposed name, Mkdir. It's then very clear that the method is creating a new directory. The fact that the method has no arguments is a clear indication that the directory name is chosen by the method itself rather than by the caller.

@mvdan
Copy link
Member

@mvdan mvdan commented May 20, 2020

I was initially against this name, because I thought testing.T.Mkdir could be confused for os.Mkdir. But Roger correctly pointed out that's very unlikely, since testing.T.Mkdir does not take any arguments.

@gopherbot
Copy link

@gopherbot gopherbot commented May 20, 2020

Change https://golang.org/cl/234558 mentions this issue: testing: rename TempDir to Mkdir

@rsc
Copy link
Contributor

@rsc rsc commented May 20, 2020

Mkdir does not convey "this is temporary". (It's not ioutil.Mkdir.) Let's leave it as TempDir. I understand the conflict with os.TempDir, but more people know about ioutil.TempDir anyway. Thanks.

@rogpeppe
Copy link
Contributor Author

@rogpeppe rogpeppe commented May 20, 2020

Fair enough. Will close.

@rogpeppe rogpeppe closed this May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.