Files
crawlab/backend/utils/helpers.go
yaziming e10d8fd996 refactor(backend): Use more efficient bytes to string methods and remove unnecessary type conversions
detail:
    1. add utils.BytesToString function instead of string() convert bytes to string.
    2. use bytes.NewReader instead of strings.NewReader(string(sb)).
    3. use w.Body.Bytes() instead of []byte(w.Body.String()).
2019-09-03 15:17:32 +08:00

8 lines
111 B
Go

package utils
import "unsafe"
func BytesToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}