]> Cypherpunks.ru repositories - gostls13.git/commitdiff
bytes, strings: s/after/before/ in CutSuffix
authorMichal Bohuslávek <mbohuslavek@gmail.com>
Thu, 18 Aug 2022 09:02:38 +0000 (11:02 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 19 Aug 2022 20:56:43 +0000 (20:56 +0000)
This follows on CL 407176 which added this function (in both
packages). This CL makes it consistent with the Cut function,
which uses “before” and “after” in return variable names.

Change-Id: Id4345d2fe0f50bf301a880803e87bf356986b518
Reviewed-on: https://go-review.googlesource.com/c/go/+/424922
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/bytes/bytes.go
src/strings/strings.go

index c0cd704180b0cd0944a9935267af4012404ac451..5cf5b477ebdb13a5a1964d6cf1558fc1e0bf7198 100644 (file)
@@ -1329,7 +1329,7 @@ func CutPrefix(s, prefix []byte) (after []byte, found bool) {
 // If suffix is the empty byte slice, CutSuffix returns s, true.
 //
 // CutSuffix returns slices of the original slice s, not copies.
-func CutSuffix(s, suffix []byte) (after []byte, found bool) {
+func CutSuffix(s, suffix []byte) (before []byte, found bool) {
        if !HasSuffix(s, suffix) {
                return s, false
        }
index 7921a20e8ab7f48b05e4084e3792e030e36b0775..1e8de2bc34cacb5af1913a60324f36369eeef340 100644 (file)
@@ -1223,7 +1223,7 @@ func CutPrefix(s, prefix string) (after string, found bool) {
 // and reports whether it found the suffix.
 // If s doesn't end with suffix, CutSuffix returns s, false.
 // If suffix is the empty string, CutSuffix returns s, true.
-func CutSuffix(s, suffix string) (after string, found bool) {
+func CutSuffix(s, suffix string) (before string, found bool) {
        if !HasSuffix(s, suffix) {
                return s, false
        }