summaryrefslogtreecommitdiff
path: root/src/regexp/regexp.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2023-04-13 13:17:26 +0100
committerGopher Robot <gobot@golang.org>2023-04-14 16:28:44 +0000
commitd4bcfe4e834da1d31b7071e83eb045e089271175 (patch)
treea94d51ab3c9aadef93de80d39d45191008db83be /src/regexp/regexp.go
parent4bd20ec884876816e8f011aea931f7b6846c3a4c (diff)
downloadgo-git-d4bcfe4e834da1d31b7071e83eb045e089271175.tar.gz
regexp: fix copy-paste typo on Regexp.UnmarshalText doc
I noticed that https://go.dev/cl/479401 called both methods MarshalText in the godoc, so fix that. While here, add more godoc links for better usability. Change-Id: I8f10bafeca6a1ca1c1ed9be7a7dd9fdecfe991a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/484335 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/regexp/regexp.go')
-rw-r--r--src/regexp/regexp.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go
index 82023868ec..1c9b2fd4de 100644
--- a/src/regexp/regexp.go
+++ b/src/regexp/regexp.go
@@ -1284,18 +1284,18 @@ func (re *Regexp) Split(s string, n int) []string {
return strings
}
-// MarshalText implements the encoding.TextMarshaler interface. The output
+// MarshalText implements [encoding.TextMarshaler]. The output
// matches that of calling the [Regexp.String] method.
//
// Note that the output is lossy in some cases: This method does not indicate
-// POSIX regular expressions (i.e. those compiled by calling CompilePOSIX), or
+// POSIX regular expressions (i.e. those compiled by calling [CompilePOSIX]), or
// those for which the [Regexp.Longest] method has been called.
func (re *Regexp) MarshalText() ([]byte, error) {
return []byte(re.String()), nil
}
-// MarshalText implements the encoding.TextUnmarshaler interface by calling
-// Compile on the encoded value.
+// UnmarshalText implements [encoding.TextUnmarshaler] by calling
+// [Compile] on the encoded value.
func (re *Regexp) UnmarshalText(text []byte) error {
newRE, err := Compile(string(text))
if err != nil {