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

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 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

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

@rsc
Copy link
Contributor

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

Fair enough. Will close.

@golang golang locked and limited conversation to collaborators May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants