1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-01 14:50:19 +00:00

only add golang.org vendor

This commit is contained in:
astaxie
2018-07-31 19:25:43 +08:00
parent 6d69047fff
commit d7b8aa8b52
474 changed files with 0 additions and 323280 deletions

View File

@ -1,27 +0,0 @@
package hack
import (
"reflect"
"unsafe"
)
// no copy to change slice to string
// use your own risk
func String(b []byte) (s string) {
pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))
pstring := (*reflect.StringHeader)(unsafe.Pointer(&s))
pstring.Data = pbytes.Data
pstring.Len = pbytes.Len
return
}
// no copy to change string to slice
// use your own risk
func Slice(s string) (b []byte) {
pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b))
pstring := (*reflect.StringHeader)(unsafe.Pointer(&s))
pbytes.Data = pstring.Data
pbytes.Len = pstring.Len
pbytes.Cap = pstring.Len
return
}