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

io/ioutil: TempDir should support patterns like TempFile does #33805

Closed
tv42 opened this issue Aug 23, 2019 · 5 comments
Closed

io/ioutil: TempDir should support patterns like TempFile does #33805

tv42 opened this issue Aug 23, 2019 · 5 comments

Comments

@tv42
Copy link

tv42 commented Aug 23, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13rc1 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tv/.cache/go-build"
GOENV="/home/tv/.config/go/env"
GOEXE=""
GOFLAGS="-trimpath"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/tv/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/tv/sdk/go1.13rc1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/tv/sdk/go1.13rc1/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/home/tv/tmp/go-build904900999=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I tried to make a temp directory with a predictable name suffix.

What did you expect to see?

A temp directory named /home/tv/.cache/foo/foo.<random string here>.ext

I expected ioutil.TempDir to follow the same new logic as TempFile now does. See
191efbc
#4896

What did you see instead?

A temp directory named /home/tv/.cache/foo/foo.*.ext<random string here>

@odeke-em odeke-em changed the title io/ioutil: TempDir should support patterns like ioutil.TempFile does proposal: io/ioutil: TempDir should support patterns like TempFile does Aug 24, 2019
@gopherbot gopherbot added this to the Proposal milestone Aug 24, 2019
@ianlancetaylor
Copy link
Contributor

Changing the prefix argument to ioutil.TempDir into a pattern argument exactly like that of ioutil.TempFile seems like a reasonable change.

Does anybody see any problems with this?

@rsc
Copy link
Contributor

rsc commented Sep 25, 2019

Given that this is exactly what we did in #4896 for TempFile and no one raised any concerns when Ian asked two weeks ago, this seems like a likely accept.

Leaving open for a week for final comments.

@rsc
Copy link
Contributor

rsc commented Oct 2, 2019

Accepted.

@rsc rsc modified the milestones: Proposal, Go1.14 Oct 2, 2019
@rsc rsc changed the title proposal: io/ioutil: TempDir should support patterns like TempFile does io/ioutil: TempDir should support patterns like TempFile does Oct 2, 2019
@odeke-em odeke-em self-assigned this Oct 2, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/198488 mentions this issue: io/ioutil: support predictable prefix+suffix for TempDir with *

@andybons andybons added Proposal and removed Proposal labels Oct 2, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@odeke-em odeke-em modified the milestones: Backlog, Go1.14 Oct 10, 2019
@odeke-em
Copy link
Member

Hey Russ, I just moved this issue from Backlog back to Go1.14 as I submitted a CL and it is just waiting on feedback on the example test before final review on merge.

@golang golang locked and limited conversation to collaborators Oct 15, 2020
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

7 participants