mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
internal/coverage/slicereader: use unsafe.String
Change-Id: Ifd88315626e0ce5b9b8d3c66aa9dd9806f8407dd Reviewed-on: https://go-review.googlesource.com/c/go/+/448555 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> Auto-Submit: Than McIntosh <thanm@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
5b42f89e39
commit
be3184c405
1 changed files with 1 additions and 8 deletions
|
|
@ -6,7 +6,6 @@ package slicereader
|
|||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"internal/unsafeheader"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
|
@ -95,11 +94,5 @@ func toString(b []byte) string {
|
|||
if len(b) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
var s string
|
||||
hdr := (*unsafeheader.String)(unsafe.Pointer(&s))
|
||||
hdr.Data = unsafe.Pointer(&b[0])
|
||||
hdr.Len = len(b)
|
||||
|
||||
return s
|
||||
return unsafe.String(&b[0], len(b))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue