From: Russ Cox Date: Fri, 28 Sep 2018 19:17:24 +0000 (-0400) Subject: regexp: add partial Deprecation comment to Copy X-Git-Tag: go1.12beta1~790 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bf68744a122b83f44cc454417d5723be04215091;p=gostls13.git regexp: add partial Deprecation comment to Copy Change-Id: I21b7817e604a48330f1ee250f7b1b2adc1f16067 Reviewed-on: https://go-review.googlesource.com/c/139784 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go index 3586029555..38b3c86d9f 100644 --- a/src/regexp/regexp.go +++ b/src/regexp/regexp.go @@ -105,9 +105,13 @@ func (re *Regexp) String() string { } // Copy returns a new Regexp object copied from re. +// Calling Longest on one copy does not affect another. // -// When using a Regexp in multiple goroutines, giving each goroutine -// its own copy helps to avoid lock contention. +// Deprecated: In earlier releases, when using a Regexp in multiple goroutines, +// giving each goroutine its own copy helped to avoid lock contention. +// As of Go 1.12, using Copy is no longer necessary to avoid lock contention. +// Copy may still be appropriate if the reason for its use is to make +// two copies with different Longest settings. func (re *Regexp) Copy() *Regexp { re2 := *re return &re2