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 <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Ian Lance Taylor 2022-02-06 19:34:32 -08:00
parent 1d6051380c
commit 334a591a3f

View file

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