From 334a591a3f4d868368913328b3e81ddf5b0f46fa Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 6 Feb 2022 19:34:32 -0800 Subject: [PATCH] os: don't repeat dir argument in CreateTemp error The dir argument is already in prefix, we shouldn't add it again. Change-Id: I42a158bec3a43950fce24f57b808da3ad8c5ef5b Reviewed-on: https://go-review.googlesource.com/c/go/+/383636 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Brad Fitzpatrick --- src/os/tempfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/tempfile.go b/src/os/tempfile.go index 5b681fcebf..3be3d13dfb 100644 --- a/src/os/tempfile.go +++ b/src/os/tempfile.go @@ -46,7 +46,7 @@ func CreateTemp(dir, pattern string) (*File, error) { if try++; try < 10000 { continue } - return nil, &PathError{Op: "createtemp", Path: dir + string(PathSeparator) + prefix + "*" + suffix, Err: ErrExist} + return nil, &PathError{Op: "createtemp", Path: prefix + "*" + suffix, Err: ErrExist} } return f, err } -- 2.50.0