mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
typo bytes2str
This commit is contained in:
parent
67c43df428
commit
8e8ee0cb75
@ -299,7 +299,7 @@ func str2bytes(s string) []byte {
|
|||||||
func bytes2str(s []byte) (p string) {
|
func bytes2str(s []byte) (p string) {
|
||||||
data := make([]byte, len(s))
|
data := make([]byte, len(s))
|
||||||
for i, c := s {
|
for i, c := s {
|
||||||
p[i] = c
|
data[i] = c
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr := (*reflect.StringHeader)(unsafe.Pointer(&p))
|
hdr := (*reflect.StringHeader)(unsafe.Pointer(&p))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user