Skip to content

Commit

Permalink
regexp: add partial Deprecation comment to Copy
Browse files Browse the repository at this point in the history
Change-Id: I21b7817e604a48330f1ee250f7b1b2adc1f16067
Reviewed-on: https://go-review.googlesource.com/c/139784
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
rsc committed Oct 12, 2018
1 parent 5160e0d commit bf68744
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/regexp/regexp.go
Expand Up @@ -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
Expand Down

0 comments on commit bf68744

Please sign in to comment.