From 62fb281cf72d4b7fa0a29500911a4af3a244f90f Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Thu, 31 Aug 2023 19:15:19 -0700 Subject: [PATCH] bytes, strings: use "reports whether" in HasPrefix and HasSuffix Update the doc comments to use the more idiomatic and common phrase "reports whether" instead of "tests whether". Change-Id: I2b7f8cce2d192f66e296ebaa9b37f37e8276b4ae Reviewed-on: https://go-review.googlesource.com/c/go/+/524898 Reviewed-by: Brad Fitzpatrick Reviewed-by: Ian Lance Taylor Auto-Submit: Matthew Dempsky LUCI-TryBot-Result: Go LUCI --- src/bytes/bytes.go | 4 ++-- src/strings/strings.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 7ecf3b59f6..9ee66cae4e 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -552,12 +552,12 @@ func Join(s [][]byte, sep []byte) []byte { return b } -// HasPrefix tests whether the byte slice s begins with prefix. +// HasPrefix reports whether the byte slice s begins with prefix. func HasPrefix(s, prefix []byte) bool { return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix) } -// HasSuffix tests whether the byte slice s ends with suffix. +// HasSuffix reports whether the byte slice s ends with suffix. func HasSuffix(s, suffix []byte) bool { return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix) } diff --git a/src/strings/strings.go b/src/strings/strings.go index 301cd8667e..ece7237c44 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -458,12 +458,12 @@ func Join(elems []string, sep string) string { return b.String() } -// HasPrefix tests whether the string s begins with prefix. +// HasPrefix reports whether the string s begins with prefix. func HasPrefix(s, prefix string) bool { return len(s) >= len(prefix) && s[0:len(prefix)] == prefix } -// HasSuffix tests whether the string s ends with suffix. +// HasSuffix reports whether the string s ends with suffix. func HasSuffix(s, suffix string) bool { return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix } -- 2.50.0