aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorMartin Möhrmann <moehrmann@google.com>2018-06-01 19:25:57 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2018-08-22 19:44:26 +0000
commitb0dc54697ba34494a4d77e8d3e446070fc7b223b (patch)
tree04afa387932cdfc751802b4bf6e50f5ba9643941 /src/runtime/string.go
parent2fad8b219ff9f13f10396c97c0a3bca5c6153d78 (diff)
downloadgo-b0dc54697ba34494a4d77e8d3e446070fc7b223b.tar.gz
go-b0dc54697ba34494a4d77e8d3e446070fc7b223b.zip
runtime: replace calls to hasprefix with hasPrefix
The hasprefix function is redundant and can be removed since it has the same implementation as hasPrefix modulo variable names. Fixes #25688 Change-Id: I499cc24a2b5c38d1301718a4e66f555fd138386f Reviewed-on: https://go-review.googlesource.com/115835 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 6e42483b13..d10bd96f43 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -333,7 +333,7 @@ func index(s, t string) int {
return 0
}
for i := 0; i < len(s); i++ {
- if s[i] == t[0] && hasprefix(s[i:], t) {
+ if s[i] == t[0] && hasPrefix(s[i:], t) {
return i
}
}
@@ -344,8 +344,8 @@ func contains(s, t string) bool {
return index(s, t) >= 0
}
-func hasprefix(s, t string) bool {
- return len(s) >= len(t) && s[:len(t)] == t
+func hasPrefix(s, prefix string) bool {
+ return len(s) >= len(prefix) && s[:len(prefix)] == prefix
}
const (