diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2020-04-25 07:01:45 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2020-04-25 18:40:45 +0000 |
commit | 7ef28cbd12d1777748affe9dccf20679665c06f9 (patch) | |
tree | b2d83d577ec473a2568bbfe705868cace4b0391e /src/testing/testing.go | |
parent | a9f8f02f3cfba18501669cdf58ae75ca36a4cff0 (diff) | |
download | go-7ef28cbd12d1777748affe9dccf20679665c06f9.tar.gz go-7ef28cbd12d1777748affe9dccf20679665c06f9.zip |
testing: give short package variable a longer name
(Update to CL 229837)
Change-Id: Ieab46bd384f76f678ef0d6a38dc043bc4b0c458a
Reviewed-on: https://go-review.googlesource.com/c/go/+/230157
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r-- | src/testing/testing.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go index 8dfb61bcc3..ed88ba51fb 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -797,10 +797,10 @@ func (c *common) Cleanup(f func()) { } } -var ( - rOnce sync.Once - r *strings.Replacer -) +var tempDirReplacer struct { + sync.Once + r *strings.Replacer +} // TempDir returns a temporary directory for the test to use. // It is lazily created on first access, and calls t.Fatal if the directory @@ -814,10 +814,10 @@ func (c *common) TempDir() string { // ioutil.TempDir doesn't like path separators in its pattern, // so mangle the name to accommodate subtests. - rOnce.Do(func() { - r = strings.NewReplacer("/", "_", "\\", "_", ":", "_") + tempDirReplacer.Do(func() { + tempDirReplacer.r = strings.NewReplacer("/", "_", "\\", "_", ":", "_") }) - pattern := r.Replace(c.Name()) + pattern := tempDirReplacer.r.Replace(c.Name()) c.tempDir, c.tempDirErr = ioutil.TempDir("", pattern) if c.tempDirErr == nil { |