aboutsummaryrefslogtreecommitdiff
path: root/src/strings/clone.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/clone.go')
-rw-r--r--src/strings/clone.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/strings/clone.go b/src/strings/clone.go
index d14df11d49..f965b5963a 100644
--- a/src/strings/clone.go
+++ b/src/strings/clone.go
@@ -5,7 +5,7 @@
package strings
import (
- "unsafe"
+ "internal/stringslite"
)
// Clone returns a fresh copy of s.
@@ -19,10 +19,5 @@ import (
// For strings of length zero the string "" will be returned
// and no allocation is made.
func Clone(s string) string {
- if len(s) == 0 {
- return ""
- }
- b := make([]byte, len(s))
- copy(b, s)
- return unsafe.String(&b[0], len(b))
+ return stringslite.Clone(s)
}