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

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

Open
tv42 opened this issue Aug 23, 2019 · 1 comment

Comments

@tv42
Copy link

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

@gopherbot gopherbot added the Proposal label Aug 24, 2019

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Sep 3, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.